Check the indentation of the clause I mark with *****
Also, do you use tabs?

def contact(request):
   if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():  ********
         asunto = form.cleaned_data['asunto']
         recado = form.cleaned_data['recado']
         email = form.cleaned_data['email']
         ccopia = form.cleaned_data['ccopia']
         from django.core.mail import send_mail
         send_mail(subject, mensaje, email, '[email protected]')
         return HttpResponseRedirect('/gracias/')
        else:
            form = ContactForm(
            initial={'subject': 'Me agrada su sitio!'}
            )
        return render(request, 'contacto_form.html', {
         'form': form,
        })


On Mon, Mar 4, 2013 at 10:05 PM, Ana Molf <[email protected]> wrote:

> I can¡t solve the follow error
>
> def contact(request):
>    if request.method == 'POST':
>         form = ContactForm(request.POST)
>         if form.is_valid():
>          asunto = form.cleaned_data['asunto']
>          recado = form.cleaned_data['recado']
>          email = form.cleaned_data['email']
>          ccopia = form.cleaned_data['ccopia']
>          from django.core.mail import send_mail
>          send_mail(subject, mensaje, email, '[email protected]')
>          return HttpResponseRedirect('/gracias/')
>         else:
>             form = ContactForm(
>             initial={'subject': 'Me agrada su sitio!'}
>             )
>         return render(request, 'contacto_form.html', {
>          'form': form,
>         })
>
> line 89
>
>
> from django.core.mail import send_mail
>                                      ^
> IndentationError: unindent does not match any outer indentation level
>
>
> Book code is not working https://docs.djangoproject.com/en/dev/topics/forms/
>
> Thanks for any comment
>
> Django 1.4.4
> 'Apache/2.2.16 (Debian)'
>
>
>  --
> 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.
>
>
>

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