Hi all,

I have a base class common for all my orthogonal models, that is,
models that hold content for other models, such as tags. This base
class also has a manager. Here are the classes:


class OrthoManager(models.Manager):
    def get_for_object(self, object):
        ctype = ContentType.objects.get_for_model(object)
        return self.filter(content_type__pk=ctype.id,
                           object_id=object.id)

    def get_for_model(self, model):
        ctype = ContentType.objects.get_for_model(model)
        return self.filter(content_type__pk=ctype.id)


class Ortho(models.Model):
    content_type = models.ForeignKey(ContentType,
                                     editable=False,
                                     blank=True,
                                     null=True)
    object_id = models.PositiveIntegerField(blank=True,
                                            editable=False,
                                            null=True)
    object = generic.GenericForeignKey('content_type', 'object_id')

    objects = OrthoManager()


When I define my orthogonal model like that:

class Tag(Ortho):
    tag = models.CharField(maxlength=50)

and try to access its manager, I get a:

Programming Error: relation "models_ortho" does not exist

i.e. it looks for the "models_ortho" table.

If I add:

objects = OrthoManager()

to the Tag model class (the inherited class), it works fine.

It seems that I cannot inherit the manager of the base class. Is this
by design? Or am I doing something wrong?

Thanks,
oMat


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to