Re: creating model instance with existing foreign key db entry

2009-03-25 Thread Malcolm Tredinnick
On Wed, 2009-03-25 at 20:38 -0700, adrian wrote: > > I have a Sighting model which has a foreign key field "notes" to a > model called Notes. > Notes has a predefined empty note with id=1. If the user specifies > no note then > I want the sighting to reference this predefined empty note. > So i

creating model instance with existing foreign key db entry

2009-03-25 Thread adrian
I have a Sighting model which has a foreign key field "notes" to a model called Notes. Notes has a predefined empty note with id=1. If the user specifies no note then I want the sighting to reference this predefined empty note. So in my view: note = form.cleaned_data['notes'] if note != "": #