Excellent, thanks for the reply

On Mar 19, 3:49 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Fri, Mar 19, 2010 at 2:08 PM, grimmus <graham.col...@gmail.com> wrote:
> > Hi,
>
> > When the form is submitted i would like to show a message above the
> > form. Much like the way if there are form errors you can print
> > form.errors
>
> > So, in my template i have entered
>
> >                    {% if form.thanks %}
> >                    thanks for submitting the form
> >                    {% endif %}
>
> > Then in the view i have
>
> >                entry.save()
> >                print form.thanks
>
> > In my Form Model i have
>
> > class SignUp(ModelForm):
>
> >    class Meta:
> >        model = MailingList
> >        exclude = ('ip_address','active','date_added')
>
> >    def thanks():
> >        return 'thanks'
>
> > I guess i am doing something wrong
>
> > Thanks for any tips
>
> Try like this instead (adjust for how your views code actually works):
>
> view:
>   if form.is_valid():
>     form.save()
>     form.thanks = True
>
> Remove the thanks method from your ModelForm, and leave your template as it 
> is.
>
> Cheers
>
> Tom

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