There are two signs with FK in one of them.
parent:
+----+---------+ | Id | Name | +----+---------+ | 1 | Test #1 | | 2 | Test #2 | | 3 | Test #3 | +----+---------+ subsidiary:
+----+---------+-----------+ | Id | Traffic | parent_id | +----+---------+-----------+ | 1 | 1000 | 1 | | 2 | 2000 | 3 | +----+---------+-----------+ I need to do a queryset for the form and connect them by key. On sql something similar to the query:
select p.parent_id, p.traffic, c.name from child c, parent p where c.parent_id = p.id The form:
class NewForm(forms.Form): query = Child.objects.all().... selectbox = forms.ModelChoiceField(queryset=query, required=True, initial=0, widget=forms.Select, label=_(u'Select field')) class Meta: fields = [ 'selectbox', ] Is there any easy way to do this?