Development #1169
Add support of Sites
Statut:
Rejeté
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
23 décembre 2011
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Non
Planning:
Description
Postponed to Authentic2 in SaaS
Historique
Mis à jour par Anonyme il y a plus de 12 ans
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.
Mis à jour par Frédéric Péters il y a plus de 9 ans
- Statut changé de Nouveau à Rejeté
- Patch proposed mis à Non
This has been superseded by multitenant support.