Commit e00b435e authored by Janez K's avatar Janez K
Browse files

dodal ukaz za avtomatsko izpolnitev polja static_image

parent 22221f4d
from 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):
ctr = 0
for a in AbstractWidget.objects.all():
if a.image and not a.static_image:
a.static_image = os.path.basename(
ctr = ctr + 1
self.stdout.write(' done\n')
self.stdout.write('%i widgets affected.\n' % ctr)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment