Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Shakour
clowdflows
Commits
e00b435e
Commit
e00b435e
authored
Nov 20, 2012
by
Janez K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dodal ukaz za avtomatsko izpolnitev polja static_image
parent
22221f4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
workflows/management/commands/fill_static_images.py
workflows/management/commands/fill_static_images.py
+21
-0
No files found.
workflows/management/commands/fill_static_images.py
0 → 100755
View file @
e00b435e
from
django.core.management.base
import
NoArgsCommand
from
workflows.models
import
*
import
os
class
Command
(
NoArgsCommand
):
help
=
'This command fills the static image field of every abstract widget in the database that doesn
\'
t have the static image field set (by using the data from the media). Use with care.'
option_list
=
NoArgsCommand
.
option_list
def
handle_noargs
(
self
,
**
options
):
self
.
stdout
.
write
(
'Working'
)
self
.
stdout
.
flush
()
ctr
=
0
for
a
in
AbstractWidget
.
objects
.
all
():
if
a
.
image
and
not
a
.
static_image
:
a
.
static_image
=
os
.
path
.
basename
(
a
.
image
.
name
)
a
.
save
()
self
.
stdout
.
write
(
'.'
)
self
.
stdout
.
flush
()
ctr
=
ctr
+
1
self
.
stdout
.
write
(
' done
\n
'
)
self
.
stdout
.
write
(
'%i widgets affected.
\n
'
%
ctr
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment