Changes between Version 20 and Version 21 of ContribAuthImprovements
- Timestamp:
- Apr 4, 2012, 3:05:05 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ContribAuthImprovements
v20 v21 145 145 Making every model pluggable. So that auth.User could be defined like this. 146 146 147 {{{ #!python147 {{{ 148 148 class User(models.Model): 149 149 __mixins__ = settings.AUTH_USER_MODEL_MIXINS … … 153 153 154 154 * Change bases before creating user-defined Model class in !ModelBase. 155 {{{ #!python155 {{{ 156 156 mixins = attrs.get('__mixins__', ()) 157 157 bases = load_available_model_mixins(mixins) + bases … … 224 224 As for Solution 2a. 225 225 226 == Solution 2d: `MYAPP_USER_MODEL` setting == 227 228 Similar 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 {{{ 235 user = models.ForeignKey(settings.ADMIN_USER_MODEL or settings.USER_MODEL) 236 }}} 237 238 === Advantages === 239 240 same as solution 2a, but 241 242 * support multiple user models 243 244 === Problems === 245 246 same as solution 2a. 247 248 226 249 == Solution 3: Leverage App Refactor == 227 250