Using sites to control models

12 views
Skip to first unread message

Larry Martell

unread,
Jun 11, 2015, 8:17:02 AM6/11/15
to django...@googlegroups.com
We have an app that is installed at many different sites, and these
sites do not all have the same database schema. This means that we
need to have different models at different sites. (The code itself is
not an issue as it's all introspective.) I'm looking for info on how
folks here have dealt with this. Currently we have a models file for
each site and we install the site specific one when we do an install.
I've been looking at the sites functionality in django and thinking
about using this. If I did this is there anything cleaner then just
doing something like this:

class Foo(models.Model):
current_site = Site.objects.get_current()
if current_site.domain == 'baz.com':
siteBazCol = models.CharField(max_length=512, null=True)
Reply all
Reply to author
Forward
0 new messages