Please paste your full traceback every time you are asking for help with
debugging.


Cheers,
AT

On Mon, Nov 21, 2011 at 3:10 PM, MikeKJ <mike.jo...@paston.co.uk> wrote:

>
> 1st time I have hit this and I am confused the subject error is returned as
> in the send_mail line
> all the fields in the model are either CharField or TextField
>
> settings.py
>
> DEFAULT_FROM_EMAIL = 'x...@xxxx.co.uk'     ---- valid email address
> CONTACT_EMAIL_TO = 'x...@xxxx.co.uk'        ---- valid email address
>
> views.py
>
> class QuestionForm(ModelForm):
>    class Meta:
>        model = AskQuestion
>
> def question(request):
>    if request.POST:
>        form = QuestionForm(request.POST)
>        if form.is_valid():
>            name = form.cleaned_data['name']
>            telephone = form.cleaned_data['telephone']
>            email = form.cleaned_data['email']
>            question = form.cleaned_data['question']
>            new = form.save()
>            msg_header = "A Question has been asked.\n\n"
>            msg_middle = "Name: %s\n\n" % form.cleaned_data['name']
>            msg_middle += "Telephone: %s\n\n" %
> form.cleaned_data['telephone']
>            msg_middle += "Email: %s\n\n" % form.cleaned_data['email']
>            msg_middle += "Question: %s\n\n" % form.cleaned_data['question']
>            send_mail(settings.EMAIL_SUBJECT_PREFIX +"Email from the
> question form", msg_header+msg_middle, settings.DEFAULT_FROM_EMAIL
> [settings.CONTACT_EMAIL_TO], fail_silently=False)
>            return HttpResponseRedirect('/question-response/')
>        else:
>            form = QuestionForm(request.POST)
>    else:
>        form = QuestionForm()
>    try:
>        exsp = SmartPage.objects.get(slug='question-form')
>    except SmartPage.DoesNotExist:
>        exsp = None
>    return render_to_repsonse("index.html", {'form': form, 'exsp': exsp,},
> context_instance=RequestContext(request))
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/string-indices-must-be-integers%2C-not-str-tp32871097p32871097.html
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>

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