mirror of
https://github.com/django/django.git
synced 2024-11-29 22:56:46 +01:00
Renamed __unicode__() to __str__() in some test comments.
This commit is contained in:
parent
db8763fb23
commit
65764a9316
@ -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.
|
||||
"""
|
||||
|
||||
|
@ -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,)))
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user