Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found the issue. I reverted some changes back and found the point where I broke it. In the following function I tried to abstract</p> <pre><code>def FormToEmail(request, token, title, subject, message, reciever, attachlist): if request.method == 'POST': sender = AddSender(request) reciever.append(sender) form = token(request.POST, request.FILES) if form.is_valid(): mail = EmailMessage(subject, message, sender, reciever) if len(attachlist) &gt; 0: for item in attachlist: if form.cleaned_data[item]: temp = request.FILES[item] mail.attach(temp.name, temp.read(), \ temp.content_type) return SendIt(request, mail) </code></pre> <p>Here to</p> <pre><code> else: form = token() if request.user.is_authenticated(): return render_to_response('FormTemplate.html', \ {'form': form, 'title' : title}, \ context_instance=RequestContext(request)) else: return HttpResponseRedirect('/Webtemplate/accounts/login') </code></pre> <p>here. Into</p> <pre><code>return RenderFormForAuth(request, token(), title) </code></pre> <p>with the function defined as </p> <pre><code>def RenderFormForAuth(request, form, title): if request.user.is_authenticated(): return render_to_response('FormTemplate.html', \ {'form': form, 'title' : title}, \ context_instance=RequestContext(request)) else: return HttpResponseRedirect('/Webtemplate/accounts/login') </code></pre> <p>which broke everything. (I can paste the whole function/ how it's called if need be, but seems like a waste of space.)</p> <p>Does anyone know why this wouldn't work?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload