Hi,

I have the following abstract model, but it's child models fail saving
with RuntimeError: maximum recursion depth exceeded

class AcceptedRoleAbstract(models.Model):
    '''
    Represents a User that should accept a role

    E.g.: Discutant, Reviewer
    '''
    user = models.OneToOneField(User)
    accepted = models.NullBooleanField(help_text=_("The reviewer
agreed to make the review"))
    updated = models.DateTimeField(auto_now=True)
    created = models.DateTimeField(auto_now_add=True)

    class Meta:
        abstract = True

    def __unicode__(self):
        return u'%s accepted: %s' % (self.user.get_full_name() or
self.user.username, str(self.accepted))

    def save(self, force_insert=False, force_update=False):
        if self.pk:
            old_accepted = self.__class__.objects.get(pk=self.pk)
        else:
            old_accepted = False
        super(self.__class__, self).save(force_insert, force_update)
        if not old_accepted == self.accepted and self.accepted==False:
            message = render_to_string('conference/
new_role_rejects_message.txt', {'object': self})
            mail_managers(_('A %s canceled his demand' %
self.__class__), message)

the child models are really simple:

class Discutant(AcceptedRoleAbstract):
    '''
    Represents a discutant
    '''
    class Meta:
        verbose_name = _('discutant')
        verbose_name_plural = _('discutants')

thanks for your help!
V
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to