Thanks Karen, that fixes the problem in the django admin. At least now
I know that everything is ok on the database and model fronts.
However, in my own form it is still not validating this relationship.

Here is what I have right now:

in a forms.py file there is a base form for the Case model:
--
class CaseFormBase(forms.Form):
    office         = forms.ModelChoiceField(widget=forms.HiddenInput,
queryset=Office.objects.all())
    case_no        = forms.CharField(max_length=20, label="Case No.")
    ...
    class Meta:
        model=Case
--

This base form is used for other forms which need to dynamically build
their option lists. This is the form for adding a new case (in a file
called 'cases.py'):
--
from app.forms import CaseFormBase
class NewCaseForm(CaseFormBase):
    county = forms.ModelChoiceField(queryset=County.objects.filter
(activecounties__office=office, activecounties__active=True ))
    ...

# form is validated and processed here:
if request.method=='POST':
    f = NewCaseForm(request.POST)
    if f.is_valid():
        new_case = (...)
        new_case.save()
--

Since this does not seem to be working, for now I've gone back to my
clean method which manually checks for duplicates. I'd rather do it
the 'right' way by using 'unique_together' but it doesn't seem to be
cooperating with my setup.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to