[Django] #25039: Automatic setup verbose_name for related fields

5 views
Skip to first unread message

Django

unread,
Jun 30, 2015, 11:25:57 AM6/30/15
to django-...@googlegroups.com
#25039: Automatic setup verbose_name for related fields
--------------------------------------+--------------------
Reporter: djbaldey | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
In a large multilingual projects often lack the simplest things. To edit
verbose_name for related objects occurred in one place.

Before:


{{{
class Foo(models.Model):
...
class Meta:
verbose_name = _('foo')


class Bar(models.Model):
foo = models.ForeignKey(Foo, verbose_name=_('foo'))
}}}

After:


{{{
class Foo(models.Model):
...
class Meta:
verbose_name = _('foo')


class Bar(models.Model):
foo = models.ForeignKey(Foo)
}}}


This patch only works when you specify a class and not a lazy reference to
the object.
It also reduces the memory consumption.

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

Django

unread,
Jun 30, 2015, 11:26:29 AM6/30/15
to django-...@googlegroups.com
#25039: Automatic setup verbose_name for related fields
----------------------------------+----------------------------

Reporter: djbaldey | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Easy pickings: 0
UI/UX: 0 |
----------------------------------+----------------------------
Changes (by djbaldey):

* Attachment "25039.diff" added.

Django

unread,
Jun 30, 2015, 12:17:24 PM6/30/15
to django-...@googlegroups.com
#25039: Automatic setup verbose_name for related fields
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

The patch uses deprecated APIs so the test suit can't run, but even when
updated as below, there are still problems running the tests.
{{{
if self.verbose_name is None and self.remote_field and not
isinstance(self.remote_field.model, six.string_types):
self.verbose_name = self.remote_field.model._meta.verbose_name
}}}

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

Django

unread,
Jul 1, 2015, 3:46:13 AM7/1/15
to django-...@googlegroups.com
#25039: Automatic setup verbose_name for related fields
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by djbaldey):

Replying to [comment:1 timgraham]:


> The patch uses deprecated APIs so the test suit can't run, but even when
updated as below, there are still problems running the tests.
> {{{
> if self.verbose_name is None and self.remote_field and not
isinstance(self.remote_field.model, six.string_types):
> self.verbose_name = self.remote_field.model._meta.verbose_name
> }}}

Sorry, that was meant for 1.8, I'll try to rewrite under master

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

Django

unread,
Jul 1, 2015, 5:58:19 AM7/1/15
to django-...@googlegroups.com
#25039: Automatic setup verbose_name for related fields
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Uncategorized | Version: master
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed

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

* status: new => closed
* resolution: => invalid


Comment:

Bad idea. It's works, but in order to do have to change a bunch of tests.

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

Reply all
Reply to author
Forward
0 new messages