On Sun, Jul 11, 2010 at 12:53 PM, Lachlan Musicman <data...@gmail.com> wrote: > On Fri, Jul 9, 2010 at 00:00, Russell Keith-Magee > <russ...@keith-magee.com> wrote: >> On Thu, Jul 8, 2010 at 3:55 PM, Lachlan Musicman <data...@gmail.com> wrote: >>> Hola, >>> >>> I'm new to this dev thing, but I've done some work on ticket #5373 > >> However, I'm also concerned about unexpected consequences for the >> second patch. The obvious use case that you're breaking is if your >> ForeignKey manually defines a verbose_name. > > I'm not quite sure I understand. Does that mean we can have > conflicting verbose_names? My mental unrolling of your advice brings > me to: > > eg 1: > class Book(models.Model): > name = models.CharField(max_length=50) > > class Meta: > verbose_name = _(u'Novel') > verbose_name_plural = _(u'Novels') > > class Author(models.Model): > name = models.CharField(max_length=50) > books = models.ManyToManyField(Book, verbose_name=_(u'Paperback')) > > In this (ugly, but possible?) case, we have conflicting verbose names. > Which should take precedence? Your note would indicate that Paperback > should?
The two verbose names are describing different things. "Novel" is the verbose name for a book object. The admin page for a list of "books" will be titled "Novel", and say "select a Novel", etc. "Paperback" is the verbose name for the relationship held between Authors and Books. Of course, your example here is a little pathological; ordinarily, if you want to have a list of novels, you'd call the object "class Novel(Model)", and if you want an author to have a list of paperbacks, you'd call the relationship "paperback = models.ManyToMany(Book...)". The only reason to get verbose_name and verbose_name_plural involved is when the automated scheme for class name de-munging won't work. The obvious use case for this is plurals: your list of Walrus objects should say "You have 3 Walruses", not "You have 3 Walruss". The edge case that I'm referring to is the case where a verbose name isn't specified on the field, and you get one inherited from the object you're related to. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.