I have been having trouble extracting data from a related data entry
field when it comes to trying to get the values from related (joined)
field. Perhaps the best way to explain what I need to do can be seen in
the code snippet attached below.


reservations=Reservation.objects.filter(pub_date__gt=some_start_date).filter(pub_date__lt=some_end_date).values('id',
'amount', 'pub_date', 'position')
positions = Position.objects.values('id', 'max_amount', 'name')
for reservation in reservations:
    pos_name =  positions.get(id=reservation['position'])['name'] #
<---this is where I have my problem
    print pos_name #<----- this is printing an empty string

Any help would be greatly appreciated :)


--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to