On Oct 8, 4:05 pm, Chris Withers <ch...@simplistix.co.uk> wrote:
> Hi All,
>
> I have a set of models that all have the same implementation for a
> method, so I thought I'd create a base class for these:
>
> class UrlModel(models.Model):
>      def get_absolute_url(self):
>          return reverse(index,kwargs=dict(fk=self.pk))
>
> ...and then have the relevant models subclass that. However, as soon as
> I did this, I started getting bizarre SQL errors, things like:
>
> ProgrammingError at /some/path
> relation "myapp_urlmodel" does not exist
> LINE 1: ...somefield1"."somefield2" FROM "myapp_modelname" INNER JOIN
> "myapp_urlm...
>
> Why is this?
>
> Chris

If your base model doesn't contain any fields, you should probably
mark it as abstract.
http://docs.djangoproject.com/en/dev/topics/db/models/#id6
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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