Development #1169
Add support of Sites
Start date:
23 Dec 2011
Due date:
% Done:
0%
Estimated time:
Patch proposed:
No
Planning:
Description
Postponed to Authentic2 in SaaS
History
Updated by Anonymous about 9 years ago
The roadmap for this feature can be the following:
- we need a middleware which put a site reference into each request (request.site), a cache must be constructed linking domain names to site ids.
- each model should gain a field like this
site = ForeignKey('sites.Site')
or like thatsites = ManyToManyField('sites.Site')
- each model visible in the admin should use a ModelAdmin which inherit from a new base class, SiteModelAdmin whose queryset() method should look like this:
def queryset(self, queryset): try: site_field = self.model._meta.get_field('site') or self.model._meta.get('sites') if site_field.name == 'site': q = Q(site=request.site)|Q(site__isnull=True) return queryset.filter(q) else: q = Q(sites=request.site)|Q(site__isnull=True) return queryset.filter(q) except FieldDoesNotExist: return queryset
the goal is to only show object linked to this site - we should integrate one of the many applications which allow to put django settings in the db
- the settings app must be extended to restrict settings by site
- some caching must be added in order to not touch the db for each access to the settings
- the AdminSite.has_permission() method should be overloaded to only permit staff users linked to the site using a new table to link users to Site objects.
This should maybe be implemented as a different admin site from the main one which should keep access to all object for superusers.
I'm still looking how to force newly created object to be associated to the current site without doing it manually everywhere.
Updated by Frédéric Péters over 6 years ago
- Status changed from Nouveau to Rejeté
- Patch proposed set to No
This has been superseded by multitenant support.