Hi all,
This is a difficulty related to me being new to Django/Python I
assume, so I hope you can forgive my ignorance and help me out :)
I have 4 tables - User(overriding the user object), Copy, Query,
QueryClassification. The main tables are Copy and Query. There can be
many Queries for each Copy, so...
Query has:
copy = models.ForeignKey(Copy)
classification = models.ManyToManyField(QueryClassification)
Copy has:
user = models.ForeignKey(User)
Basically it isn't displaying any of the fields from Query or
QueryClassification and I'm not quite sure how to reference the other
foreign tables in reference to a one-to-many field. Clearly I can
iterate through the Copy items, but I can't get it to print the
multiple Query items next to the appropriate Copy items.
Below is some code for context:
#views.py
def copy_query(request, copy, query):
obj_list = copy.objects.select_related()
template_name = 'query/copyquery.html'
return render_to_response(template_name, {'object_list':
obj_list,})
The page outputs the following multi-column list. Where you see
brackets, that's me isolating where data particularly isn't showing.
The data that isn't showing is the data from Query and
QueryClassification.
Copy with Queries
* 34 1085 alexk 292 ST-S (--distpool) (--q) (--c) (--
req) Yes - Q8 = Pp, Q9 = No (--expl)
* 34 1081 alexk 292 ST-S (--distpool) (--q) (--c) (--
req) Yes - Q8 = Pa, Q9 = No (--expl)
* 34 1079 alexk 292 ST-S (--distpool) (--q) (--c) (--
req) Yes - Q8 = Pr, Q9 = No (--expl)
* 34 1073 alexk 292 ST-S (--distpool) (--q) (--c) (--
req) Yes - Q8 = Py, Q9 = No (--expl)
Regards and thanks,
Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---