set model field some value before add
class Structure(models.Model):
parent =
models.ForeignKey('site.Structure',blank=True,null=True,default=0)
title = models.CharField(max_length=128,verbose_name=u'Заголовок')
url = models.CharField(max_length=48,verbose_name=u'URL')
ordering = models.IntegerField(blank=True,editable=False,default=1)
level = models.SmallIntegerField(blank=True,editable=False,default=1)
I'd like to set Structure.ordering and Structure.level with special
values, based on something.
Is there way to provide Structure.before_add(self) method? I need this
method to be called every time after saving model data.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home