mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #13301 -- Corrected problem with capitalization of changelist row headers in admin. Thanks to emyller for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12947 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f4c76fb604
commit
faceca7075
7 changed files with 29 additions and 19 deletions
|
@ -16,7 +16,7 @@ class Article(models.Model):
|
|||
|
||||
def test_from_model_with_override(self):
|
||||
return "nothing"
|
||||
test_from_model_with_override.short_description = "not what you expect"
|
||||
test_from_model_with_override.short_description = "not What you Expect"
|
||||
|
||||
class Count(models.Model):
|
||||
num = models.PositiveSmallIntegerField()
|
||||
|
|
|
@ -157,7 +157,7 @@ class UtilTests(unittest.TestCase):
|
|||
"another name"
|
||||
)
|
||||
self.assertEquals(
|
||||
label_for_field("title2", Article, return_attr=True),
|
||||
label_for_field("title2", Article, return_attr=True),
|
||||
("another name", None)
|
||||
)
|
||||
|
||||
|
@ -179,24 +179,24 @@ class UtilTests(unittest.TestCase):
|
|||
return "nothing"
|
||||
self.assertEquals(
|
||||
label_for_field(test_callable, Article),
|
||||
"test_callable"
|
||||
"Test callable"
|
||||
)
|
||||
self.assertEquals(
|
||||
label_for_field(test_callable, Article, return_attr=True),
|
||||
("test_callable", test_callable)
|
||||
("Test callable", test_callable)
|
||||
)
|
||||
|
||||
self.assertEquals(
|
||||
label_for_field("test_from_model", Article),
|
||||
"test_from_model"
|
||||
"Test from model"
|
||||
)
|
||||
self.assertEquals(
|
||||
label_for_field("test_from_model", Article, return_attr=True),
|
||||
("test_from_model", Article.test_from_model)
|
||||
("Test from model", Article.test_from_model)
|
||||
)
|
||||
self.assertEquals(
|
||||
label_for_field("test_from_model_with_override", Article),
|
||||
"not what you expect"
|
||||
"not What you Expect"
|
||||
)
|
||||
|
||||
self.assertEquals(
|
||||
|
@ -207,15 +207,16 @@ class UtilTests(unittest.TestCase):
|
|||
class MockModelAdmin(object):
|
||||
def test_from_model(self, obj):
|
||||
return "nothing"
|
||||
test_from_model.short_description = "not really the model"
|
||||
test_from_model.short_description = "not Really the Model"
|
||||
|
||||
self.assertEquals(
|
||||
label_for_field("test_from_model", Article, model_admin=MockModelAdmin),
|
||||
"not really the model"
|
||||
"not Really the Model"
|
||||
)
|
||||
self.assertEquals(
|
||||
label_for_field("test_from_model", Article,
|
||||
model_admin = MockModelAdmin,
|
||||
return_attr = True
|
||||
),
|
||||
("not really the model", MockModelAdmin.test_from_model)
|
||||
("not Really the Model", MockModelAdmin.test_from_model)
|
||||
)
|
||||
|
|
|
@ -474,7 +474,7 @@ class Post(models.Model):
|
|||
|
||||
class PostAdmin(admin.ModelAdmin):
|
||||
list_display = ['title', 'public']
|
||||
readonly_fields = ('posted', 'awesomeness_level', 'coolness', lambda obj: "foo")
|
||||
readonly_fields = ('posted', 'awesomeness_level', 'coolness', 'value', lambda obj: "foo")
|
||||
|
||||
inlines = [
|
||||
LinkInline
|
||||
|
@ -486,6 +486,9 @@ class PostAdmin(admin.ModelAdmin):
|
|||
else:
|
||||
return "Unkown coolness."
|
||||
|
||||
def value(self, instance):
|
||||
return 1000
|
||||
value.short_description = 'Value in $US'
|
||||
|
||||
class Gadget(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
@ -567,7 +570,7 @@ class CyclicTwo(models.Model):
|
|||
return self.name
|
||||
|
||||
class Topping(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
name = models.CharField(max_length=20)
|
||||
|
||||
class Pizza(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
|
|
|
@ -1970,6 +1970,7 @@ class ReadonlyTest(TestCase):
|
|||
self.assertContains(response, '<div class="form-row coolness">')
|
||||
self.assertContains(response, '<div class="form-row awesomeness_level">')
|
||||
self.assertContains(response, '<div class="form-row posted">')
|
||||
self.assertContains(response, '<div class="form-row value">')
|
||||
self.assertContains(response, '<div class="form-row ">')
|
||||
|
||||
p = Post.objects.create(title="I worked on readonly_fields", content="Its good stuff")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue