Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
2349cbd9
Kaydet (Commit)
2349cbd9
authored
Eyl 25, 2018
tarafından
Ramon Saraiva
Kaydeden (comit)
Tim Graham
Eyl 26, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29782 -- Added better error message when filtering queryset with AnonymousUser.
üst
18098d26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
AUTHORS
AUTHORS
+1
-0
models.py
django/contrib/auth/models.py
+3
-0
test_models.py
tests/auth_tests/test_models.py
+8
-0
No files found.
AUTHORS
Dosyayı görüntüle @
2349cbd9
...
...
@@ -694,6 +694,7 @@ answer newbie questions, and generally made Django that much better:
Ramez Ashraf <ramezashraf@gmail.com>
Ramin Farajpour Cami <ramin.blackhat@gmail.com>
Ramiro Morales <ramiro@rmorales.net>
Ramon Saraiva <ramonsaraiva@gmail.com>
Ram Rachum <ram@rachum.com>
Randy Barlow <randy@electronsweatshop.com>
Raphaël Barrois <raphael.barrois@m4x.org>
...
...
django/contrib/auth/models.py
Dosyayı görüntüle @
2349cbd9
...
...
@@ -383,6 +383,9 @@ class AnonymousUser:
def
__hash__
(
self
):
return
1
# instances always return the same hash value
def
__int__
(
self
):
raise
TypeError
(
'Cannot cast AnonymousUser to int. Are you trying to use it in place of User?'
)
def
save
(
self
):
raise
NotImplementedError
(
"Django doesn't provide a DB representation for AnonymousUser."
)
...
...
tests/auth_tests/test_models.py
Dosyayı görüntüle @
2349cbd9
...
...
@@ -345,6 +345,14 @@ class AnonymousUserTests(SimpleTestCase):
def
test_hash
(
self
):
self
.
assertEqual
(
hash
(
self
.
user
),
1
)
def
test_int
(
self
):
msg
=
(
'Cannot cast AnonymousUser to int. Are you trying to use it in '
'place of User?'
)
with
self
.
assertRaisesMessage
(
TypeError
,
msg
):
int
(
self
.
user
)
def
test_delete
(
self
):
with
self
.
assertRaisesMessage
(
NotImplementedError
,
self
.
no_repr_msg
):
self
.
user
.
delete
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment