[Tutor] model methods in Django

eryksun eryksun at gmail.com
Sun May 19 13:04:46 CEST 2013


On Sun, May 19, 2013 at 6:35 AM, Matthew Ngaha <chigga101 at gmail.com> wrote:
>
> if you look at the diagram under that function, why is the value of
> "was_published_recently.short_description" the title of that field?
> replacing the old title? is a "short_desccription" attribute set
> somewhere in django being inactive, but once you make use of this
> attribute(or keyword), whatever the value is automatically becomes the
> field title? is it the same for boolean being the value of the field
> with the checked or unchecked symbol?

For example, see line 586 in admin/options.py:

https://github.com/django/django/blob/1.5.1/django/contrib/admin/options.py#L586

        # Gather actions from the admin site first
        for (name, func) in self.admin_site.actions:
            description = getattr(func, 'short_description',
name.replace('_', ' '))
            actions.append((func, name, description))

The default description is the name with underscores removed, unless
you set a custom description in the function's "short_description"
attribute. I'm not experienced with Django, so I can't ramble off lots
of examples, but hopefully you get the gist.


More information about the Tutor mailing list