I've got a system with three main tables, say "offices", "commercial
spaces" and "industrial properties". Many of their features, like the
type of glass of their windows, need to come from a catalog, so I have
a base class like:

class SimpleNameCatalog(models.Model):
    name = models.CharField()
    class Meta:
        abstract = True


And a bunch of subclasses like:

class GlassType(SimpleNameCatalog):
    pass

And add foreign keys from the three main tables to GlassType.

However, now I need separate glass types for each of "offices",
"commercial spaces" and "industrial properties". ¿How should I
implemente this?

Right now I'm using:

class GlassTypeOffice(SimpleNameCatalog):
    pass
class GlassTypeIndustrialProperty(SimpleNameCatalog):
    pass
class GlassTypeCommercialSpace(SimpleNameCatalog):
    pass

for each catalog property, but it seems silly and exceedingly verbose.
Should I add a "type" field to SimpleNameCatalog and filter by that? I
don't like that option very much because I want to keep the separate
catalogs distinct in the admin interface.

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