Hi, First let me say I've looked at documentation, but feel a bit dyslexic when it comes to this stuff.
The situation: I have three tables: a service provider table with city, state abbreviation and country abbreviation (among other other info), a states table with state names, abbreviations, and other state info, and a country table with country names, abbreviations and other country info. I want an output like: _______________________ FULL COUNTRY NAME Full State Name City..... Provider Provider City..... Provider Full State Name City..... Provider Provider City..... Provider FULL COUNTRY NAME _______________________ I only want Country and State headings for countries and states having providers. Experimenting at the shell, it appears my model is okay: _________________________________________________ >>> from mhd.models import * >>> countries = Country.objects.filter(iso2__in=["US","CA"]).distinct() >>> countries [<Country: Canada>, <Country: United States of America>] >>> countries[0].state_set.all() [<State: Alberta>, <State: British Columbia>, <State: Manitoba>, ...] >>> countries[1].state_set.all() [<State: Alabama>, <State: Alaska>, <State: Arizona>, ...] >>> countries[1].state_set.all()[1] <State: Alaska> >>> countries[1].state_set.all()[1].provider_set.all() [<Provider: Anne B. ... PsyS, LPC None>] >>> countries[1].state_set.all()[1].provider_set.all()[0] <Provider: Anne B. ... PsyS, LPC None> >>> countries[1].state_set.all()[1].provider_set.all()[0].practitioner u'Anne B. ... PsyS, LPC' >>> countries[1].state_set.all()[1].provider_set.all()[0].city u'Anchorage' _________________________________________________ For the next 5 days, a whittled down version of what I thought I was trying to do lives on dpaste.com: http://dpaste.com/32704/ model.py http://dpaste.com/32755/ views.py http://dpaste.com/32706/ listings.html template However my later experiments in the manage.py shell (above) lead me to suspect maybe I'm bass-ackwards about the whole thing. Unfortunately, suspecting that is still not enough to get me where I'm trying to go. Help? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---