On Wednesday, February 23, 2011 02:15:40 pm geraldcor wrote:
> Hello all,
> 
> When rendering a list of data for a particular model instance, I am
> wondering how to access the label_tag attribute for a field when not
> using a form.
> 
> In my view I get a model instance and pass the object in my context
> 
> inspection = inspection.objects.get(pk=3)
> 
> Then in my template I want to be able to do the following:
> 
> <div>{{ inspection.requester.label_tag }} {{ inspection.requester }}</
> div>
> ...
> 
> But it seems you can only access label_tag when you are rendering a
> form. Any way to do this with a queryset?
> 
> Greg

In this case you're going to want to do it manually, i.e.:

<div><label>Requester</label> {{ inspection.requester }}</div>

make sure to reference the model field you want as the label if 'Requester' 
isn't it.


Mike.
-- 
"The hottest places in Hell are reserved for those who, in times of moral
crisis, preserved their neutrality."
-- Dante

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to