views:

257

answers:

2

I'd like to have access to one my model field verbose_name.

I can get it by the field indice like this

model._meta._fields()[2].verbose_name

but I need to get it dynamically. Ideally it would be something like this

model._meta._fields()['location_x'].verbose_name

I've looked at a few things but I just can't find it.

+2  A: 
model._meta.get_field_by_name('location_x')[0].verbose_name
Ignacio Vazquez-Abrams
+2  A: 
model._meta.get_field_by_name('location')[0].verbose_name
Dmitry Shevchenko
wow, within 1 minute. Thanks
PhilGo20