(tables) verbose name

16 views
Skip to first unread message

Kless

unread,
Jan 23, 2009, 7:36:36 AM1/23/09
to Django Apps
There is to declare a 'verbose_name' for each field.
------------
class BookTable(tables.ModelTable):
book_name = tables.Column(verbose_name='book title')
------------

But this already has been declared in our models:
------------
class Book(models.Model):
name = models.CharField('book title', max_length=50)
------------

I think that verbose name --from tables.Column-- could be filled
automatically with the model value.

Michael Elsdörfer

unread,
Jan 23, 2009, 8:26:51 AM1/23/09
to Django Apps
Kless, thanks for the suggestion. I know this is something that should
be added, it's already in the TODO section of the readme file. I'll
see when I get to it.

Michael

Kless

unread,
Jan 23, 2009, 11:06:57 AM1/23/09
to Django Apps
Thank to you Michael for your great work. I was looking for an
application as yours where the user can choose/search data from a
table.

Kless

unread,
Feb 21, 2009, 1:16:00 PM2/21/09
to Django Apps
Here is how to get the verbose name of a field:

As example, if I've a field as:

en_name = models.CharField(
_('english name'), max_length=60, unique=True)
--------------
In [88]: field = models.Table._meta._fields()[3]

In [89]: field.name
Out[89]: 'en_name'

In [90]: unicode(field.verbose_name)
Out[90]: u'english name'
--------------

This post is very usefull to know working with metadata in models:
http://www.b-list.org/weblog/2007/nov/04/working-models/


On 23 ene, 13:26, Michael Elsdörfer <elsdoer...@gmail.com> wrote:

Michael Elsdörfer

unread,
Feb 21, 2009, 6:12:43 PM2/21/09
to Django Apps
If you want to write a patch, I'll happily consider it ;)

One thing to think about here is whether there are other field options
that potentially should be used also, say for example editable=False
=> visible=False.

Michael
Reply all
Reply to author
Forward
0 new messages