Changes between Version 20 and Version 21 of ContribAuthImprovements


Ignore:
Timestamp:
04/04/2012 03:05:05 AM (3 years ago)
Author:
bhuztez
Comment:

solution 2d MYAPP_USER_MODEL setting

Legend:

Unmodified
Added
Removed
Modified
  • ContribAuthImprovements

    v20 v21  
    145145Making every model pluggable. So that auth.User could be defined like this.
    146146
    147 {{{#!python
     147{{{
    148148class User(models.Model):
    149149    __mixins__ = settings.AUTH_USER_MODEL_MIXINS
     
    153153
    154154 * Change bases before creating user-defined Model class in !ModelBase.
    155      {{{#!python
     155     {{{
    156156     mixins = attrs.get('__mixins__', ())
    157157     bases = load_available_model_mixins(mixins) + bases
     
    224224As for Solution 2a.
    225225
     226== Solution 2d: `MYAPP_USER_MODEL` setting ==
     227
     228Similar to solution 2a, but instead of a single global `USER_MODEL` setting, each app has its own `USER_MODEL` setting.
     229
     230=== Implementation ===
     231
     232`django.contrib.admin` can introduce an `ADMIN_USER_MODEL` setting which defaults to `None`.
     233
     234{{{
     235user = models.ForeignKey(settings.ADMIN_USER_MODEL or settings.USER_MODEL)
     236}}}
     237
     238=== Advantages ===
     239
     240same as solution 2a, but
     241
     242 * support multiple user models
     243
     244=== Problems ===
     245
     246same as solution 2a.
     247
     248
    226249== Solution 3: Leverage App Refactor ==
    227250
Back to Top