I am trying to get a lot of different tables that are related by primary keys and regular identifiers.
Do not try to join tables. This is not SQL.
You need to make several queries to get data from different tables.
Do not worry about select_relateduntil you can prove that you have a throat.
Just do different GETs from different classes as needed.
.
class Rating( Model ):
...
class Candidate( Model ):
rating = Models.ForeignKey( Rating )
.
r = Rating.objects.get( id=rating_id )
c = r.candidate_set.all()
, . - - SQL-: . ORM Django . Django ( ) .
, .
:
r = Rating.objects.get( id=rating_id )
return render_to_response( some_form, { 'rating':r } )
:
Rating: {{rating}}. Candidates: {% for c in rating.candidate_set.all %} {{c}} {%endfor%}
Etc.
"" , .