Permalink
19 comments
on commit
sign in to comment.
Browse files
Fixed #3011 -- Added swappable auth.User models.
Thanks to the many people that contributed to the development and review of this patch, including (but not limited to) Jacob Kaplan-Moss, Anssi Kääriäinen, Ramiro Morales, Preston Holmes, Josh Ourisman, Thomas Sutton, and Roger Barnes, as well as the many, many people who have contributed to the design discussion around this ticket over many years. Squashed commit of the following: commit d84749a Merge: 531e771 7c11b1a Author: Russell Keith-Magee <russell@keith-magee.com> Date: Wed Sep 26 18:37:04 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit 531e771 Merge: 29d1abb 1f84b04 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Wed Sep 26 07:09:23 2012 +0800 Merged recent trunk changes. commit 29d1abb Merge: 8a527dd 54c81a1 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Sep 24 07:49:46 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit 8a527dd Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Sep 24 07:48:05 2012 +0800 Ensure sequences are reset correctly in the presence of swapped models. commit e2b6e22 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 23 17:53:05 2012 +0800 Modifications to the handling and docs for auth forms. commit 98aba85 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 23 15:28:57 2012 +0800 Improved error handling and docs for get_user_model() commit 0229209 Merge: 6494bf9 8599f64 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 23 14:50:11 2012 +0800 Merged recent Django trunk changes. commit 6494bf9 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Sep 17 21:38:44 2012 +0800 Improved validation of swappable model settings. commit 5a04cde Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Sep 17 07:15:14 2012 +0800 Removed some unused imports. commit ffd535e Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 20:31:28 2012 +0800 Corrected attribute access on for get_by_natural_key commit 913e1ac Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 20:12:34 2012 +0800 Added test for proxy model safeguards on swappable models. commit 280bf19 Merge: dbb3900 935a863 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 18:16:49 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit dbb3900 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 18:09:27 2012 +0800 Fixes for Python 3 compatibility. commit dfd7213 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 15:54:30 2012 +0800 Added protection against proxying swapped models. commit abcb027 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 15:11:10 2012 +0800 Cleanup and documentation of AbstractUser base class. commit a9491a8 Merge: fd8bb4e 08bcb4a Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 14:46:49 2012 +0800 Merge commit '08bcb4aec1ed154cefc631b8510ee13e9af0c19d' into t3011 commit fd8bb4e Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 14:20:14 2012 +0800 Documentation improvements coming from community review. commit b550a6d Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 13:52:47 2012 +0800 Refactored skipIfCustomUser into the contrib.auth tests. commit 52a02f1 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 13:46:10 2012 +0800 Refactored common 'get' pattern into manager method. commit b441a6b Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 16 13:41:33 2012 +0800 Added note about backwards incompatible change to admin login messages. commit 08bcb4a Author: Anssi Kääriäinen <akaariai@gmail.com> Date: Sat Sep 15 18:30:33 2012 +0300 Splitted User to AbstractUser and User commit d9f5e5a Author: Anssi Kääriäinen <akaariai@gmail.com> Date: Sat Sep 15 18:30:02 2012 +0300 Reworked REQUIRED_FIELDS + create_user() interaction commit 579f152 Merge: 9184972 93e6733 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 15 20:18:37 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit 9184972 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 15 20:18:19 2012 +0800 Deprecate AUTH_PROFILE_MODULE and get_profile(). commit 334cdfc Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 15 20:00:12 2012 +0800 Added release notes for new swappable User feature. commit 5d7bb22 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 15 19:59:49 2012 +0800 Ensure swapped models can't be queried. commit 57ac6e3 Merge: f2ec915 abfba3b Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 15 14:31:54 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit f2ec915 Merge: 1952656 5e99a3d Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 9 08:29:51 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit 1952656 Merge: 2c5e833 c4aa26a Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 9 08:22:26 2012 +0800 Merge recent changes from master. commit 2c5e833 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 9 07:53:46 2012 +0800 Corrected admin_views tests following removal of the email fallback on admin logins. commit 20d1892 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sun Sep 9 01:00:37 2012 +0800 Added conditional skips for all tests dependent on the default User model commit 40ea8b8 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 8 23:47:02 2012 +0800 Added documentation for REQUIRED_FIELDS in custom auth. commit e6aaf65 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Sat Sep 8 23:20:02 2012 +0800 Added first draft of custom User docs. Thanks to Greg Turner for the initial text. commit 75118bd Author: Thomas Sutton <me@thomas-sutton.id.au> Date: Mon Aug 20 11:17:26 2012 +0800 Admin app should not allow username discovery The admin app login form should not allow users to discover the username associated with an email address. commit d088b3a Author: Thomas Sutton <me@thomas-sutton.id.au> Date: Mon Aug 20 10:32:13 2012 +0800 Admin app login form should use swapped user model commit 7e82e83 Merge: e29c010 39aa890 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Fri Sep 7 23:45:03 2012 +0800 Merged master changes. commit e29c010 Merge: 8e3fd70 30bdf22 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Aug 20 13:12:57 2012 +0800 Merge remote-tracking branch 'django/master' into t3011 commit 8e3fd70 Merge: 507bb50 26e0ba0 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Aug 20 13:09:09 2012 +0800 Merged recent changes from trunk. commit 507bb50 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Jun 4 20:41:37 2012 +0800 Modified auth app so that login with alternate auth app is possible. commit dabe362 Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Jun 4 20:10:51 2012 +0800 Modified auth management commands to handle custom user definitions. commit 7cc0baf Author: Russell Keith-Magee <russell@keith-magee.com> Date: Mon Jun 4 14:17:28 2012 +0800 Added model Meta option for swappable models, and made auth.User a swappable model
- Loading branch information...
Showing
with
1,412 additions
and 343 deletions.
- +2 −0 django/conf/global_settings.py
- +2 −13 django/contrib/admin/forms.py
- +4 −2 django/contrib/admin/models.py
- +20 −14 django/contrib/admin/sites.py
- +1 −1 django/contrib/admin/templates/admin/base.html
- +1 −1 django/contrib/admin/templates/admin/login.html
- +1 −0 django/contrib/admin/views/decorators.py
- +22 −1 django/contrib/auth/__init__.py
- +15 −9 django/contrib/auth/backends.py
- +14 −0 django/contrib/auth/fixtures/custom_user.json
- +11 −4 django/contrib/auth/forms.py
- +21 −11 django/contrib/auth/management/__init__.py
- +10 −6 django/contrib/auth/management/commands/changepassword.py
- +63 −59 django/contrib/auth/management/commands/createsuperuser.py
- +107 −66 django/contrib/auth/models.py
- +13 −24 django/contrib/auth/tests/__init__.py
- +5 −0 django/contrib/auth/tests/auth_backends.py
- +38 −7 django/contrib/auth/tests/basic.py
- +2 −1 django/contrib/auth/tests/context_processors.py
- +75 −0 django/contrib/auth/tests/custom_user.py
- +3 −1 django/contrib/auth/tests/decorators.py
- +7 −1 django/contrib/auth/tests/forms.py
- +99 −1 django/contrib/auth/tests/management.py
- +6 −0 django/contrib/auth/tests/models.py
- +4 −0 django/contrib/auth/tests/remote_user.py
- +2 −0 django/contrib/auth/tests/signals.py
- +2 −0 django/contrib/auth/tests/tokens.py
- +9 −0 django/contrib/auth/tests/utils.py
- +30 −0 django/contrib/auth/tests/views.py
- +1 −0 django/contrib/auth/tokens.py
- +14 −5 django/contrib/auth/views.py
- +11 −6 django/contrib/comments/models.py
- +12 −1 django/core/exceptions.py
- +1 −0 django/core/management/commands/sqlall.py
- +1 −1 django/core/management/commands/syncdb.py
- +1 −0 django/core/management/commands/validate.py
- +10 −2 django/core/management/sql.py
- +24 −3 django/core/management/validation.py
- +21 −12 django/core/validators.py
- +8 −2 django/db/backends/__init__.py
- +8 −8 django/db/backends/creation.py
- +14 −6 django/db/models/base.py
- +27 −8 django/db/models/fields/related.py
- +1 −0 django/db/models/loading.py
- +7 −2 django/db/models/manager.py
- +18 −3 django/db/models/options.py
- +2 −1 django/test/__init__.py
- +2 −0 django/test/testcases.py
- +5 −2 django/test/utils.py
- +3 −0 docs/internals/deprecation.txt
- +21 −6 docs/ref/settings.txt
- +42 −0 docs/releases/1.5.txt
- +359 −0 docs/topics/auth.txt
- +106 −4 tests/modeltests/invalid_models/invalid_models/models.py
- +11 −2 tests/modeltests/invalid_models/tests.py
- +36 −2 tests/modeltests/proxy_models/tests.py
- +57 −45 tests/regressiontests/admin_views/tests.py
| @@ -0,0 +1,14 @@ | ||
| +[ | ||
| + { | ||
| + "pk": "1", | ||
| + "model": "auth.customuser", | ||
| + "fields": { | ||
| + "password": "sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161", | ||
| + "last_login": "2006-12-17 07:03:31", | ||
| + "email": "staffmember@example.com", | ||
| + "is_active": true, | ||
| + "is_admin": false, | ||
| + "date_of_birth": "1976-11-08" | ||
| + } | ||
| + } | ||
| +] |
Oops, something went wrong.
avanheuvelen repliedSep 26, 2012
That's beautiful. Congratulations guys!
vdboor repliedSep 26, 2012
Awesome to see this commit, and fully agree on the removal of
get_profile(). It distracted developers from the fact you can just have a one-to-one relation betweenUserand aUserProfilemodel.I'm curious, why is
@skipIfCustomUsernot written as@skip_if_custom_user?freakboy3742 repliedSep 26, 2012
@vdboor - It's @skipifcustomuser to maintain consistency with the rest of unittest.
streeter repliedSep 26, 2012
Congrats!
nicholasserra repliedSep 26, 2012
Yes!
eyvoro repliedSep 27, 2012
+1
anentropic repliedSep 27, 2012
Woooo!!!
rach repliedSep 27, 2012
It's Christmas before Christmas !!! Alleluia
charettes repliedSep 27, 2012
@rach We'll this should be officially released on Christmas eve :)
phonkee repliedSep 27, 2012
Great news!
Istergul repliedSep 28, 2012
miracle!
gciding repliedSep 28, 2012
Awesome news!
voron3x repliedSep 28, 2012
+100500
alfuken repliedSep 28, 2012
Awesome! And it took only 6 years!! Nice.
agafonovdmitry repliedSep 28, 2012
curious, why not in "class Meta" stuff?
vdboor repliedOct 3, 2012
@agafonovdmitry: I guess because the
Optionsclass (whichmodel._metais) only accepts a fixed set of known fields.class Metaisn't a bag of state you can just throw any attribute at, unless someone finds a way to extend that mechanism (e.g. via the base class). Yet I would also like to know what was decided about that in django-core.igorsobreira repliedOct 11, 2012
Why don't provide
USERNAME_FIELD = 'username'onAbstractUserclass? And maybe a placeholder (None?) toAbstractBaseUser?This could avoid the
getattr(UserModel, 'USERNAME_FIELD', 'username')spread everywhere.freakboy3742 repliedOct 11, 2012
See ticket #19079. A fix doing exactly this is on the way.
igorsobreira repliedOct 11, 2012
Nice!