[Django] #17308: Use short description with properties in the admin

193 views
Skip to first unread message

Django

unread,
Nov 28, 2011, 7:43:40 AM11/28/11
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
-------------------------------+--------------------
Reporter: pmartin | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: SVN
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
If you use a property in a list_display (e.g.) the name of the column will
be a "pretty name" of the name of the property.

But this property could use "short_description" as follow (See patch)

--
Ticket URL: <https://code.djangoproject.com/ticket/17308>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 28, 2011, 3:10:16 PM11/28/11
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
--------------------------------------+------------------------------------
Reporter: pmartin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by anonymous):

* needs_docs: => 1
* needs_better_patch: => 0
* type: New feature => Cleanup/optimization
* needs_tests: => 1
* stage: Unreviewed => Accepted


Comment:

This needs a quick simple test, and perhaps a bullet point in the docs
under the section on list_display - but otherwise looks like a good idea,
as you shouldn't be penalized for making use of your methods as
properties.

--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:1>

Django

unread,
Feb 24, 2013, 7:38:14 AM2/24/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
--------------------------------------+------------------------------------
Reporter: pmartin | Owner: viciu
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by viciu):

* owner: nobody => viciu
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:2>

Django

unread,
Feb 24, 2013, 8:42:29 AM2/24/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
--------------------------------------+------------------------------------
Reporter: pmartin | Owner: viciu
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by viciu):

I've reviewed a patch and it works for the use case when property is not
set with @property decorator.

So this will work:

{{{
def test_label_for_property(self):
class MockModelAdmin(object):
def fget(self):
return "this if from property"
fget.short_description = 'property short description'
test_from_property = property(fget=fget)

self.assertEqual(
label_for_field("test_from_property", Article,
model_admin=MockModelAdmin),
'property short description'
)
}}}

but this will not:

{{{
def test_label_for_property_decorator(self):
class MockModelAdmin(object):
@property
def test_from_property(self):
return "this if from property"
test_from_property.short_description = 'property short
description'
}}}

throwing

AttributeError: 'property' object has no attribute 'short_description'

--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:3>

Django

unread,
Feb 24, 2013, 9:09:56 AM2/24/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
-------------------------------------+-------------------------------------
Reporter: pmartin | Owner: viciu
Type: | Status: assigned
Cleanup/optimization | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Design
Keywords: | decision needed

Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by viciu):

* stage: Accepted => Design decision needed


Comment:

In my opinion this needs decision/discussion, because setting
short_description is limited to usage of property as a function, not as a
decorator.

This is better then nothing on the other hand.

I may however send a pull request (patch + tests) if this is ok.

--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:4>

Django

unread,
Mar 23, 2013, 9:11:23 AM3/23/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
--------------------------------------+------------------------------------
Reporter: pmartin | Owner: viciu

Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* stage: Design decision needed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:5>

Django

unread,
May 18, 2013, 9:12:33 AM5/18/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
--------------------------------------+------------------------------------
Reporter: pmartin | Owner: viciu
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by viciu):

Pull request here: https://github.com/django/django/pull/1104

--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:6>

Django

unread,
May 18, 2013, 12:04:37 PM5/18/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
--------------------------------------+------------------------------------
Reporter: pmartin | Owner: viciu
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by lpiatek):

* needs_docs: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:7>

Django

unread,
May 18, 2013, 7:21:07 PM5/18/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
-------------------------------------+-------------------------------------
Reporter: pmartin | Owner: viciu

Type: | Status: assigned
Cleanup/optimization | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by lpiatek):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:8>

Django

unread,
May 21, 2013, 7:20:21 AM5/21/13
to django-...@googlegroups.com
#17308: Use short description with properties in the admin
-------------------------------------+-------------------------------------
Reporter: pmartin | Owner: viciu
Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.admin | Resolution: fixed

Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Florian Apolloner <florian@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"cec9558fba1bc6401ea2ec6d71b816b4dfd31b28"]:
{{{
#!CommitTicketReference repository=""
revision="cec9558fba1bc6401ea2ec6d71b816b4dfd31b28"
Fixed #17308 -- Enabled the use of short_description on properties in the
admin.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/17308#comment:9>

Reply all
Reply to author
Forward
0 new messages