I'd like to set some attributes to some default values before the model is created. Here's what I have so far:
slots_available = models.IntegerField(blank=True) position = models.IntegerField(blank=True) def save(self): if slots_availalbe == None: slots_available = StorageUnitType.objects.get(pk=parent).total_slots if position == None: position = 1 super(StorageUnit, self).save() Is this the best way of doing this? Is there a way I can specify that this code should run only when a model is first saved? I read something about using listeners for some post and pre save signals, but wasn't able to find any documentation on it. TIA --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---