Hello,

I have 2 models: car and salesman. I want to make a form based off the car 
model. Salesman name is a foreign key in the car model. In the form, I want 
to be able to enter the salesman's name and if it doesn't exist already 
then create a new salesman.

So I have something like this in forms.py

class Car(forms.ModelForm):

salesman_name = forms.CharField()

class Meta:
model = Car

But when I enter something into the salesman_name field it errors:

Cannot assign "u'x'": "Salesman.name" must be a "Salesman" instance.


How do I override that? So that it creates a new salesman when the entered one 
doesn't match a current one?


Thank you,


Lev

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to