Django admin sortable won't save -
i have in models.py:
class upload(models.model): discussion = models.foreignkey(discussion, blank=true, null=true) upload = thumbnailerfield(upload_to='upload/%s/%s' % (datetime.datetime.now().year, datetime.datetime.now().month )) mimetype = models.charfield(max_length=50, default="application/octet-stream") order = models.integerfield(blank=true, null=true, default=0) and in admin.py:
class uploadinline(admin.stackedinline): model = upload = 0 sortable_field_name = 'order' and register uploadinline this:
class discussionadmin(contentadmin): inlines = [ uploadinline ] it displays okay , can add new uploads, ordering doesn't work. resets press save.
any ideas what's happening here? use similar ordering in other places in app , works normally.
i have figured out problem. functionality in question belongs grapelli. when i've had figured out, simple matter of reading docs.
in order work, had add in upload class:
class meta: ordering = ['order'] and it. works okay.
Comments
Post a Comment