In your model, overide the save method :
def save(self):
# get number of objects
maxNumber = 5
current = MyModel.objects.all().count()
if current < maxNumber:
super(MyModel, self).save()
#you can either pass - object won't be saved, or raise an exception
cheers,
arthur
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---