It would by DRYer to add a property to the Options class in
django/db/models/options.py that returned the dotted path. I'm proposing
the name "label".
--
Ticket URL: <https://code.djangoproject.com/ticket/24693>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by aaugustin):
Yes please!
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:1>
Comment (by MarkusH):
+1
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:2>
* owner: nobody => johngian
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:3>
Comment (by timgraham):
We also want to add a `label_lower` property that returns `'%s.%s' %
(model._meta.app_label, model._meta.model_name)` as that's another
repeated pattern.
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:4>
Comment (by bmispelon):
What's the advantage of doing `options.label_lower` rather than
`options.label.lower()`?
Or are these two different things?
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:5>
* cc: MarkusH (added)
Comment:
`options.app_label` is never converted to lower case.
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:6>
Comment (by bmispelon):
Ah yes, that makes sense. Sorry for the noise :)
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:7>
* owner: johngian => delgiudices
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:8>
Comment (by delgiudices):
Added pull request: https://github.com/django/django/pull/4566
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:9>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:10>
Comment (by MarkusH):
About the documentation for this PR: I think we should make
`options.label` and `options.label_lower` public API.
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:11>
Comment (by delgiudices):
I've added tests, changes in the docs, looked for places in django source
code old labels were used and replaced with `model._meta.label` or
`model._meta.label_lower`
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:12>
* needs_docs: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:13>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:14>
* cc: alasdair@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:15>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:16>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"69ddc1b3da043195a0f4e09211d395724b42c70b" 69ddc1b]:
{{{
#!CommitTicketReference repository=""
revision="69ddc1b3da043195a0f4e09211d395724b42c70b"
Fixed #24693 -- Added label and label_lower property to Model._meta
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24693#comment:17>