On Oct 6, 6:28 pm, Aaron <aa...@genieknows.com> wrote: > On Oct 6, 2:09 pm, Karen Tracey <kmtra...@gmail.com> wrote: > > > Yes, you'll have to save the change to the DB. But note if you were called > > with force_insert=True you do not want to call the superclass save with > > force_insert=True twice. > > OK. Would calling "super(MyModel, self).save(False, force_update)" be > safe for the second save call? > > > Personally I'd look pretty closely at the need to store a value dependent on > > the primary key in some other field of the model. Is this really absolutely > > necessary? > > It's needed to generate a default value for this particular field. > This field has a unique constraint, but the field's value may not > necessarily be specified when the model is created. This is > independent of Django's admin interface, so using prepopulated_fields > in the model's ModelAdmin cannot be relied upon.
Does that field need to be unique on its own? Could you use unique_together = ('id', 'otherfield') to set a constraint that is unique for the combination of those two fields? -- DR. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---