diff options
| author | Berker Peksag <berker.peksag@gmail.com> | 2014-11-27 04:18:47 +0200 |
|---|---|---|
| committer | Erik Romijn <eromijn@solidlinks.nl> | 2014-11-27 11:57:54 +0100 |
| commit | 8819f6f7c9ffb78a13ed3e19803d89b6637358c6 (patch) | |
| tree | 356d48b9601fa2f5a2cc057c3aab06361d41cf6c /docs | |
| parent | 6f65bd1cf08c7dff9581d9033a6d534f3202eb27 (diff) | |
[1.7.x] Fixed #23847 -- Improved the email_check example in the auth documentation.
Backport of 87bd13617c57a806deb550e3af1c06ce00517a9c from master.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/auth/default.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index a7fc349ced..ba9516d0ae 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -500,7 +500,7 @@ The simple way is to run your test on :attr:`request.user checks to make sure the user has an email in the desired domain:: def my_view(request): - if not '@example.com' in request.user.email: + if not request.user.email.endswith('@example.com'): return HttpResponse("You can't vote in this poll.") # ... @@ -511,7 +511,7 @@ checks to make sure the user has an email in the desired domain:: from django.contrib.auth.decorators import user_passes_test def email_check(user): - return '@example.com' in user.email + return user.email.endswith('@example.com') @user_passes_test(email_check) def my_view(request): |
