Hi,

I changed it to this. and i am pretty sure this is correct
def cvdetails(request, id):
  if request.method == 'POST':
    f = cvForm(request.POST)
    if form.is_valid():
      return HttpResponseRedirect('cm/cvdetails.html')
  else:
    f = cvForm()
  return render_to_response('cm/cvdetails.html', {'f':f,})

but now i get this error: not sure if u have gotten it before:

*error*

TemplateSyntaxError at /cm/21003/cv/

Caught an exception while rendering: 'session'

traceback is:

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
    result = node.render(context)
  File "/home/cpcs/portal/stafftracker/templatetags/avail_tag.py",
line 10, in render
    session=context['session']
  File "/usr/lib/python2.5/site-packages/django/template/context.py",
line 44, in __getitem__
    raise KeyError(key)
KeyError: 'session'

and it highlights what part of template its in:

line 16 {% get_availability %}  on application.html is causing the
problem. but this application is the main page that is rendered for
every single page. so my cvdetails.html extends application.html but
it gives me this error when it does not for any other page.

any ideas on what maybe causing this?

thanks


On Apr 16, 11:01 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Apr 16, 3:22 pm, Daxal <daxal.someone...@gmail.com> wrote:
>
>
>
> > Hey guys,
>
> > I am trying to render a modelmultiplechoicefield on my template and i
> > cannot seem to figure out how. any help would be appreciated.
>
> > Thanks.
>
> > Here is model:
> > class cvdb(models.Model):
> >   user = models.ForeignKey(User)
> >   Language = models.ManyToManyField(Language,
> > db_table='cm_cvdb_language',
> >                                     verbose_name="languages")
> >   ProfDesgn = models.ManyToManyField(ProfDesgn,
> > db_table='cm_cvdb_profdesgn',
> >                                      verbose_name="professional
> > designation", blank=True)
> >   Practice = models.ManyToManyField(Practice,
> > db_table='cm_cvdb_practice',
> >                                     verbose_name="Practice",
> > blank=True)
> >   Sector = models.ManyToManyField(Sector, db_table='cm_cvdb_sector',
> >                                   verbose_name="Sector", blank=True)
> >   Profession = models.ManyToManyField(Profession,
> > db_table='cm_cvdb_profession',
> >                                       verbose_name="Profession",
> > blank=True)
> >   Country = models.ManyToManyField(Country,
> > db_table='cm_cvdb_country',
> >                                    verbose_name="Country", blank=True)
>
> > Here is my form:
> > class cvForm(forms.Form):
> >   Language =
> > forms.ModelMultipleChoiceField(queryset=Language.objects.all())
> >   ProfDesgn =
> > forms.ModelMultipleChoiceField(queryset=ProfDesgn.objects.all(),
> > required=False)
> >   Practice =
> > forms.ModelMultipleChoiceField(queryset=Practice.objects.all(),
> > required=False)
> >   Sector =
> > forms.ModelMultipleChoiceField(queryset=Sector.objects.all(),
> > required=False)
> >   Profession =
> > forms.ModelMultipleChoiceField(queryset=Profession.objects.all(),
> > required=False)
> >   Country =
> > forms.ModelMultipleChoiceField(queryset=Country.objects.all(),
> > required=False)
>
> > My view is going to look something like:
>
> > def cvdetails(request, id):
> >    contact= User.objects.get(pk=id)
> >    *show the six modelmultiplefields...*
> >    *save*
> >    return render('cm/cvdetails.html', request)
>
> > any idea on how to even start the views?        :S
>
> > I am reallllllly confused.
>
> > Thank youuu for all your help!!!    <3
>
> It's a form. You don't "show" the fields in the view, you instantiate
> the form and pass it to the template. 
> See:http://docs.djangoproject.com/en/1.1/topics/forms/#using-a-form-in-a-...
> --
> DR.
>
> --
> 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 
> athttp://groups.google.com/group/django-users?hl=en.

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