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
65764a93
Kaydet (Commit)
65764a93
authored
Kas 19, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Renamed __unicode__() to __str__() in some test comments.
üst
db8763fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
+13
-15
admin.py
tests/admin_views/admin.py
+2
-4
tests.py
tests/admin_views/tests.py
+10
-10
tests.py
tests/model_inheritance/tests.py
+1
-1
No files found.
tests/admin_views/admin.py
Dosyayı görüntüle @
65764a93
...
...
@@ -508,8 +508,7 @@ class CoverLetterAdmin(admin.ModelAdmin):
"""
A ModelAdmin with a custom get_queryset() method that uses defer(), to test
verbose_name display in messages shown after adding/editing CoverLetter
instances.
Note that the CoverLetter model defines a __unicode__ method.
instances. Note that the CoverLetter model defines a __str__ method.
For testing fix for ticket #14529.
"""
...
...
@@ -545,8 +544,7 @@ class TelegramAdmin(admin.ModelAdmin):
"""
A ModelAdmin with a custom get_queryset() method that uses only(), to test
verbose_name display in messages shown after adding/editing Telegram
instances.
Note that the Telegram model defines a __unicode__ method.
instances. Note that the Telegram model defines a __str__ method.
For testing fix for ticket #14529.
"""
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
65764a93
...
...
@@ -3811,7 +3811,7 @@ class AdminCustomQuerysetTest(TestCase):
def
test_add_model_modeladmin_defer_qs
(
self
):
# Test for #14529. defer() is used in ModelAdmin.get_queryset()
# model has __
unicode
__ method
# model has __
str
__ method
self
.
assertEqual
(
CoverLetter
.
objects
.
count
(),
0
)
# Emulate model instance creation via the admin
post_data
=
{
...
...
@@ -3831,7 +3831,7 @@ class AdminCustomQuerysetTest(TestCase):
reverse
(
'admin:admin_views_coverletter_change'
,
args
=
(
pk
,)),
html
=
True
)
# model has no __
unicode
__ method
# model has no __
str
__ method
self
.
assertEqual
(
ShortMessage
.
objects
.
count
(),
0
)
# Emulate model instance creation via the admin
post_data
=
{
...
...
@@ -3854,7 +3854,7 @@ class AdminCustomQuerysetTest(TestCase):
def
test_add_model_modeladmin_only_qs
(
self
):
# Test for #14529. only() is used in ModelAdmin.get_queryset()
# model has __
unicode
__ method
# model has __
str
__ method
self
.
assertEqual
(
Telegram
.
objects
.
count
(),
0
)
# Emulate model instance creation via the admin
post_data
=
{
...
...
@@ -3874,7 +3874,7 @@ class AdminCustomQuerysetTest(TestCase):
reverse
(
'admin:admin_views_telegram_change'
,
args
=
(
pk
,)),
html
=
True
)
# model has no __
unicode
__ method
# model has no __
str
__ method
self
.
assertEqual
(
Paper
.
objects
.
count
(),
0
)
# Emulate model instance creation via the admin
post_data
=
{
...
...
@@ -3897,7 +3897,7 @@ class AdminCustomQuerysetTest(TestCase):
def
test_edit_model_modeladmin_defer_qs
(
self
):
# Test for #14529. defer() is used in ModelAdmin.get_queryset()
# model has __
unicode
__ method
# model has __
str
__ method
cl
=
CoverLetter
.
objects
.
create
(
author
=
"John Doe"
)
self
.
assertEqual
(
CoverLetter
.
objects
.
count
(),
1
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_coverletter_change'
,
args
=
(
cl
.
pk
,)))
...
...
@@ -3912,7 +3912,7 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
CoverLetter
.
objects
.
count
(),
1
)
# Message should contain non-ugly model verbose name. Instance
# representation is set by model's __
unicode
__()
# representation is set by model's __
str
__()
self
.
assertContains
(
response
,
'<li class="success">The cover letter "<a href="
%
s">'
...
...
@@ -3920,7 +3920,7 @@ class AdminCustomQuerysetTest(TestCase):
reverse
(
'admin:admin_views_coverletter_change'
,
args
=
(
cl
.
pk
,)),
html
=
True
)
# model has no __
unicode
__ method
# model has no __
str
__ method
sm
=
ShortMessage
.
objects
.
create
(
content
=
"This is expensive"
)
self
.
assertEqual
(
ShortMessage
.
objects
.
count
(),
1
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_shortmessage_change'
,
args
=
(
sm
.
pk
,)))
...
...
@@ -3946,7 +3946,7 @@ class AdminCustomQuerysetTest(TestCase):
def
test_edit_model_modeladmin_only_qs
(
self
):
# Test for #14529. only() is used in ModelAdmin.get_queryset()
# model has __
unicode
__ method
# model has __
str
__ method
t
=
Telegram
.
objects
.
create
(
title
=
"Frist Telegram"
)
self
.
assertEqual
(
Telegram
.
objects
.
count
(),
1
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_telegram_change'
,
args
=
(
t
.
pk
,)))
...
...
@@ -3961,7 +3961,7 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
Telegram
.
objects
.
count
(),
1
)
# Message should contain non-ugly model verbose name. The instance
# representation is set by model's __
unicode
__()
# representation is set by model's __
str
__()
self
.
assertContains
(
response
,
'<li class="success">The telegram "<a href="
%
s">'
...
...
@@ -3969,7 +3969,7 @@ class AdminCustomQuerysetTest(TestCase):
reverse
(
'admin:admin_views_telegram_change'
,
args
=
(
t
.
pk
,)),
html
=
True
)
# model has no __
unicode
__ method
# model has no __
str
__ method
p
=
Paper
.
objects
.
create
(
title
=
"My Paper Title"
)
self
.
assertEqual
(
Paper
.
objects
.
count
(),
1
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_paper_change'
,
args
=
(
p
.
pk
,)))
...
...
tests/model_inheritance/tests.py
Dosyayı görüntüle @
65764a93
...
...
@@ -19,7 +19,7 @@ from .models import (
class
ModelInheritanceTests
(
TestCase
):
def
test_abstract
(
self
):
# The Student and Worker models both have 'name' and 'age' fields on
# them and inherit the __
unicode
__() method, just as with normal Python
# them and inherit the __
str
__() method, just as with normal Python
# subclassing. This is useful if you want to factor out common
# information for programming purposes, but still completely
# independent separate models at the database level.
...
...
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