I have 2 tables, document and event. I want to retrieve the document url and 
the event date but it seems like I can't do this in a single query set and 
that is then used directly in a template. This was my first thought:

context = {
        'minutes': Document.objects.filter(documentType=1, 
event__eventType=1).values('documentFile', 
'event__start_date').order_by('event__start_date')
    }

with the template looking like 

{% for scm in minutes %}
    &sdot; <a target="belldocument" href="{{ scm.documentFile.url }}">{{ 
scm.event__start_date|optTimeShort }}</a><br>
{% endfor %}

The problem is that the values() command turns the FileField into a string.

If I remove the values() command I can access the event through event_set 
but it's not clear to me how to access the one and only event in the set 
within the template.

Do I just need to do a little more pre-processing in the view or can I 
accomplish what I'm trying to do?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/kFEzUs3fmigJ.
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