I’ve been doing some models of a future app, and, after adding verbose_name and verbose_name_plural to every entry on a working model, for making it ‘beautiful’, I’ve found that at validate time, Django doesn’t like that, so it says:
File '/home/andor/Documentos/desarrollo/grundymanage/../grundymanage/concursantes/models.py', line 4, in <module> class Concursante(models.Model): File '/home/andor/Documentos/desarrollo/grundymanage/../grundymanage/concursantes/models.py', line 7, in Concursante nombre_artistico = models.CharField(verbose_name='Nombre Artístico', verbose_name_plural='Nombres Artísticos', max_length=50) TypeError: __init__() got an unexpected keyword argument 'verbose_name_plural'
My model begins like this:
# -*- encoding: utf-8 -*- from django.db import models class Concursante(models.Model): nombre = models.CharField(verbose_name='Nombre', max_length=30) apellidos = models.CharField(verbose_name='Apellidos', max_length=50) nombre_artistico = models.CharField(verbose_name='Nombre Artístico', verbose_name_plural='Nombres Artísticos', max_length=50)
Why ‘he’ didn’t expects a plural verbose name there? Cannot live together with verbose_name?
FYI, this are my software versions:
- Ubuntu 8.04
- Python 2.5.2
- Django ‘1’ ‘0’ ‘final’
- Django ubuntu package version ‘1.0-1ubuntu1’
Unfortunately,
verbose_name_pluralis not an option on the field. It’s a meta option for the model itself. A field has no plural name since, unless it’s a many-to-many relationship (in which case Django will use the plural for the model pointed to by the relationship), there’s only one entity in that field.Here’s the doc section: http://docs.djangoproject.com/en/dev/topics/db/models/#id3