Commit ac349d94 authored by Okhin's avatar Okhin
Browse files

Displaying the captchas field

parent f68dce81
......@@ -145,11 +145,9 @@ def sendverifymail(service,to,body):
return actid
class AddForm(FormView):
model = Violation
template_name = 'index.html'
form_class = AddViolation
success_url = '/'
context_object_name = 'violations'
def form_valid(self, form):
msg=_("Thank you for submitting a new report. To finalize your submission please confirm using your validation key.\nYour verification key is %s/%s%s\nPlease note that reports are moderated, it might take some time before your report appears online. Thank you for your patience.")
......@@ -167,7 +165,8 @@ class AddForm(FormView):
contractual = form.cleaned_data['contractual'],
contract_excerpt = sanitizeHtml(form.cleaned_data['contract_excerpt']),
loophole = form.cleaned_data['loophole'],
activationid = actid
activationid = actid,
old = False
)
v.save()
#c=Confirmation(key='', email=form.cleaned_data['email'], violation=v)
......@@ -181,7 +180,7 @@ class AddForm(FormView):
violation=v,
)
c.save()
for f in request.FILES.getlist('attachments[]'):
for f in self.request.FILES.getlist('attachments[]'):
a=Attachment(comment=c, name=f.name, type=f.content_type)
m = hashlib.sha256()
for chunk in f.chunks():
......@@ -189,7 +188,7 @@ class AddForm(FormView):
sname=m.hexdigest()
a.storage.save(sname,f)
a.save()
messages.add_message(request, messages.INFO, _('Thank you for submitting this report, you will receive a verification email immediately, if not check your spam folder.'))
messages.add_message(self.request, messages.INFO, _('Thank you for submitting this report, you will receive a verification email immediately, if not check your spam folder.'))
return super(AddForm, self).form_valid(form)
def get_context_data(self, **kwargs):
......
......@@ -145,8 +145,17 @@
<h2>{% trans "Add New Case" %}</h2>
</div>
<div class="panel-body">
{% if forms.error %}
{% for field in form %}
{% for error in field.error %}
<div class="alert alert-error">
{{ error|escape }}
</div>
{% endfor %}
{% endfor %}
{% endif %}
<p>{% trans "Please report cases of zero-rating (services which are excluded from your download limit), specialised services or the blocking, throttling or prioritisation of online services. For a more detailed description of what to report, check our <a href='/about/#guidelines'>guidelines</a>." %}
<form name="addForm" enctype="multipart/form-data" action="{% root_url %}/add/" method="post" class="form">
<form name="addForm" enctype="multipart/form-data" action="/" method="post" class="form">
{% csrf_token %}
{% bootstrap_field form.resource_name %}
{% bootstrap_field form.country %}
......@@ -165,7 +174,7 @@
{% bootstrap_field form.consent %}
{% bootstrap_field form.email %}
{% bootstrap_field form.nick %}
{% bootstrap_field form.email %}
{% bootstrap_field form.captcha %}
{% buttons %}
<button type="submit" class="btn btn-primary">{% trans "save" %}</button>
{% endbuttons %}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment