> This does offend the DRY principle, but until Django has a prettier
> way of handling this, I will put up with the duplication.

Python gurus: Is it possible to write a python function
HasAssociatedRecordsAndIsRestricted() that would introspect the model
and database and restore DRY at this point?

e.g.

class Nlgroup(models.Model):
  description = models.CharField(maxlength=80)
  def delete(self):
    if not HasAssociatedRecordsAndIsRestricted():
      super(Nlgroup, self).delete() # Call the "real" delete()
method

class People(models.Model):
  nl_group = models.ForeignKey(Nlgroup, cascade="restrict")


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to