Code

Changes between Version 21 and Version 22 of ContribAuthImprovements


Ignore:
Timestamp:
04/04/12 01:32:59 (2 years ago)
Author:
bhuztez
Comment:

Solution 2e: MYAPP_USER_MODEL setting (b)

Legend:

Unmodified
Added
Removed
Modified
  • ContribAuthImprovements

    v21 v22  
    224224As for Solution 2a. 
    225225 
    226 == Solution 2d: `MYAPP_USER_MODEL` setting == 
     226== Solution 2d: `MYAPP_USER_MODEL` setting (a) == 
    227227 
    228228Similar to solution 2a, but instead of a single global `USER_MODEL` setting, each app has its own `USER_MODEL` setting. 
     
    245245 
    246246same as solution 2a. 
     247 
     248== Solution 2e: `MYAPP_USER_MODEL` setting (b) == 
     249 
     250A combination of solution 2b and 2d. Every model is pluggable and each app has its own `USER_MODEL` setting. 
     251 
     252=== Implementation === 
     253 
     254`django.contrib.admin` can introduce an `ADMIN_USER_MODEL` setting which defaults to `"auth.user"`. 
     255 
     256{{{ 
     257user = models.ForeignKey(settings.ADMIN_USER_MODEL) 
     258}}} 
     259 
     260=== Advantages === 
     261 
     262 * support multiple user models 
     263 * Existing projects require no migration. the same as solution 2/2a.  
     264 * Unlike solution 2a, change is not required for existing apps, if they do not use a different user model. 
     265 * Unrelated and third-party apps can indicate that they depend on various orthogonal mixins. the same as solution 2a.  
     266 
     267=== Problems === 
     268 
     269same as solution 2b, and 
     270 
     271 * As with Solution 2, prone to unpredictable problems if `MYAPP_USER_MODEL` is modified after the initial syncdb.  
    247272 
    248273