From 8ddecc39dbbb4da17a4eccff29bcf95efed991b8 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Tue, 22 Nov 2011 09:14:09 +0000 Subject: Fixed #17252 -- Fixed a minor regression introduced by the work in #11868, where the default sorted columns wouldn't correctly be visually represented in the changelist table headers if those columns referred to non model fields. Thanks to sebastian for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17143 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/admin_views/models.py | 36 +++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'tests/regressiontests/admin_views/models.py') diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py index d1a5d19dd0..eb56f9b6e3 100644 --- a/tests/regressiontests/admin_views/models.py +++ b/tests/regressiontests/admin_views/models.py @@ -538,13 +538,31 @@ class ComplexSortedPerson(models.Model): age = models.PositiveIntegerField() is_employee = models.NullBooleanField() -class PrePopulatedPostLargeSlug(models.Model): - """ - Regression test for #15938: a large max_length for the slugfield must not - be localized in prepopulated_fields_js.html or it might end up breaking - the javascript (ie, using THOUSAND_SEPARATOR ends up with maxLength=1,000) - """ - title = models.CharField(max_length=100) - published = models.BooleanField() +class PrePopulatedPostLargeSlug(models.Model): + """ + Regression test for #15938: a large max_length for the slugfield must not + be localized in prepopulated_fields_js.html or it might end up breaking + the javascript (ie, using THOUSAND_SEPARATOR ends up with maxLength=1,000) + """ + title = models.CharField(max_length=100) + published = models.BooleanField() slug = models.SlugField(max_length=1000) - + +class AdminOrderedField(models.Model): + order = models.IntegerField() + stuff = models.CharField(max_length=200) + +class AdminOrderedModelMethod(models.Model): + order = models.IntegerField() + stuff = models.CharField(max_length=200) + def some_order(self): + return self.order + some_order.admin_order_field = 'order' + +class AdminOrderedAdminMethod(models.Model): + order = models.IntegerField() + stuff = models.CharField(max_length=200) + +class AdminOrderedCallable(models.Model): + order = models.IntegerField() + stuff = models.CharField(max_length=200) -- cgit v1.3