Commit 0161a2d3 authored by okhin's avatar okhin 🚴

Merge branch 'feat_52' into 'master'

Feat 52

Closes #52

See merge request !56
parents e67ab765 120b5ef1
Pipeline #990 passed with stage
in 10 seconds
......@@ -46,6 +46,13 @@ tool.
python migrate
## Run server
To run server, just do:
python runserver
# To deploy in production
## Set-up uwsgi
You need to create an application for uwsgi. Create a file in
......@@ -78,7 +85,7 @@ Now you need to activate the apps by creating a symoblic link into
cd /etc/uwsgi/apps-enabled
ln -s ../apps-available/nnmond.conf
service restart uwsgi
service uwsgi restart
## Set-up apache
......@@ -33,4 +33,4 @@ class OperatorAdmin(admin.ModelAdmin):
list_display = ("__unicode__", "reported_violations")
search_fields = ('name', )
pass, OperatorAdmin), OperatorAdmin)
\ No newline at end of file
......@@ -67,6 +67,7 @@ STATUS = (
('verified', _('Verified')),
('duplicate', _('Duplicate')),
('ooscope', _('Out of scope')),
('resolved', _('Resolved')),
('closed', _('Closed')),
......@@ -102,12 +103,15 @@ class Violation(models.Model):
old = models.BooleanField(default="False")
creation_date = models.DateField(auto_now_add=True)
def confirmations(self):
return self.confirmation_set.filter(key='').count()
def __unicode__(self):
return "#%s %s/%s" % (,, self.operator)
class Admin:
def confirmations(self):
return self.confirmation_set.filter(key='').count()
def operator(self):
......@@ -115,8 +119,14 @@ class Violation(models.Model):
def get_absolute_url(self):
return reverse('violation_url', args=[])
def __unicode__(self):
return "#%s %s/%s" % (,, self.operator)
def is_resolved(self):
return self.state == 'resolved'
def reopen_if_needed(self):
if self.is_resolved:
self.state = 'new'
class Comment(models.Model):
submitter_email = models.EmailField()
......@@ -112,14 +112,24 @@ def moderate(request):
return HttpResponseRedirect('/') # Redirect after POST
return render_to_response('view.html', { 'v': v, 'key': request.GET.get('key') },context_instance=RequestContext(request))
from django.db import transaction
def confirm(request, id, name=None):
violation = Violation.objects.filter(pk=id).first()
if violation:
if name:
if Confirmation.objects.filter(email=name, violation=id).count()==0:
msg=_("Thank you for confirming a case. To finalize your confirmation please validate using your confirmation key.\nYour confirmation key is %s/%s%s")
actid=sendverifymail('confirm/',name, msg)
c=Confirmation(key=actid, email=name, violation=Violation.objects.get(pk=id))
c=Confirmation(key=actid, email=name, violation=violation)
# should except IntegrityError properly
return HttpResponse(unicode(_('Thank you, this has been already confirmed')))
return HttpResponse(unicode(_('Thank you for your confirmation')))
body {
padding-top: 100px;
min-height: 2000px; /*pour débug, à retirer.*/
tbody th, tbody td {
vertical-align: middle !important;
p, label, nav, .dl-horizontal, table {
font-size: 1.3em;
p.lead {
font-size: 2em;
.dl-horizontal dt {
width: 70%;
.dl-horizontal dd {
margin-left: 80%;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -67,11 +67,16 @@ $("#sortedList").tablesorter({
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{|media }}</a></td>
<td>{{ violation.confirmations }}</td>
{% if violation.is_resolved %}
<button role="button" class="btn btn-default" data-toggle="modal" data-target="#modal-{{ }}">{% trans "Reopen" %}</button>
{% else %}
<button role="button" class="btn btn-default" data-toggle="modal" data-target="#modal-{{ }}">{% trans "Me too!" %}</button>
{% endif %}
<div class="modal fade" id="modal-{{ }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ }}" data-backdrop="false">
<div class="modal-dialog">
<div class="modal-content">
<form method="post" class="metoo inline-from" action="/confirm/{{ }}" id="i{{ }}">
<form method="post" class="metoo inline-from" action="/confirm/{{ }}" id="{{ }}">
<div class="modal-body">
<div class="form-group">
<label for="list-email-{{ }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
......@@ -91,4 +91,4 @@ if settings.DEV_SERVER == True:
{'document_root': settings.MEDIA_PATH}),
\ No newline at end of file
respect-my-net @ 0269482a
Subproject commit 0269482a42e9cba7a24730f30f5b7957029dbde6
Markdown is supported
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