Hi guys,

I am trying to save manytomany fields in the database.

---------- view -------------------

def cvdetails(request, id):
  if request.method == 'POST':
    form = cvdbForm(request.POST)
    if form.is_valid():

      *save functions here*

      request.flash.notice = "Save successful"
      return HttpResponseRedirect('.')
    if not form.is_valid():
      request.flash.errors = errors_to_list(form.errors)
  else:
    form = cvdbForm()
  return render_to_response('cm/cvdetails.html',
context_instance=RequestContext(request, {'form': form}))

thats what i have so far. this view renders a form and it works fine.
the cvdbForm details are below:

------ form --------
class cvdbForm(forms.Form):
  user = forms.ModelChoiceField(queryset=User.objects.all()) #hidden
  language_set =
forms.ModelMultipleChoiceField(queryset=C.Language.objects.all(),
required=False)
  profdesgn_set =
forms.ModelMultipleChoiceField(queryset=C.ProfDesgn.objects.all(),
required=False)
  practice_set =
forms.ModelMultipleChoiceField(queryset=C.Practice.objects.all(),
required=False)
  sector_set =
forms.ModelMultipleChoiceField(queryset=C.Sector.objects.all(),
required=False)
  profession_set =
forms.ModelMultipleChoiceField(queryset=C.Profession.objects.all(),
required=False)
  country_set =
forms.ModelMultipleChoiceField(queryset=C.Country.objects.all(),
required=False)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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