On Wed, Jul 4, 2012 at 8:21 PM, Roy Smith <r...@panix.com> wrote:
> I'm just staring to explore admin actions.  I'm surprised to see that you 
> have to set the description by doing:
>
> my_action_function.short_description = "blah"
>
> wouldn't it be cleaner to just declare a doc string for the action function 
> and have short_description grabbed from there?

No - because a docstring and a short description serve different
purposes. A docstring documents the purpose of the method. The
short_description is a label that can be used for display purposes --
a 'human readable' version of the method name.

For example:

def reset(…):
    "Reset all the things to their original values"
    ….
reset.short_description = "Reset all the things"

Although you may often be able to compose a docstring that could also
serve as a short_description, it won't always be possible; hence, a
distinction is made so you can be explicit about exactly what you
want.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to