Commit 054ad23e authored by stef's avatar stef

[enh] listing of reports

parent 0a0ae097
...@@ -52,9 +52,9 @@ class Violation(models.Model): ...@@ -52,9 +52,9 @@ class Violation(models.Model):
country = models.CharField(max_length=2, choices=COUNTRIES) country = models.CharField(max_length=2, choices=COUNTRIES)
operator = models.CharField(max_length=256) operator = models.CharField(max_length=256)
contract = models.CharField(max_length=256) contract = models.CharField(max_length=256)
resource = models.CharField(max_length=1, choices=RESOURCES) resource = models.CharField(max_length=20, choices=RESOURCES)
type = models.CharField(max_length=1, choices=TYPES) type = models.CharField(max_length=20, choices=TYPES)
media = models.CharField( max_length=1, choices=MEDIA) media = models.CharField( max_length=20, choices=MEDIA)
temporary = models.BooleanField( ) temporary = models.BooleanField( )
contractual = models.BooleanField() contractual = models.BooleanField()
contract_excerpt = models.TextField() contract_excerpt = models.TextField()
......
...@@ -4,6 +4,7 @@ from django.shortcuts import render_to_response ...@@ -4,6 +4,7 @@ from django.shortcuts import render_to_response
from django.template import RequestContext from django.template import RequestContext
from django.core.files import File from django.core.files import File
from django.conf import settings from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from models import Violation, Attachment, Comment from models import Violation, Attachment, Comment
from tempfile import mkstemp from tempfile import mkstemp
from datetime import datetime from datetime import datetime
...@@ -55,4 +56,15 @@ def ajax(request, country=None, operator=None): ...@@ -55,4 +56,15 @@ def ajax(request, country=None, operator=None):
return HttpResponse('["Basic", "Surfer", "Gamer", "Pro", "Business"]') return HttpResponse('["Basic", "Surfer", "Gamer", "Pro", "Business"]')
def index(request): def index(request):
return HttpResponse("ohai, nothing to see here") v_list = Violation.objects.all()
paginator = Paginator(v_list, 25)
page = request.GET.get('page','1')
try:
violations = paginator.page(page)
except PageNotAnInteger:
violations = paginator.page(1)
except EmptyPage:
violations = paginator.page(paginator.num_pages)
return render_to_response('list.html', {"violations": violations})
...@@ -7,6 +7,8 @@ h2 { margin: auto; width: 50%; padding 4em; } ...@@ -7,6 +7,8 @@ h2 { margin: auto; width: 50%; padding 4em; }
.fieldWrapper label { width: 200px; display: inline-block; } .fieldWrapper label { width: 200px; display: inline-block; }
.help_text { font-size: 0.7em; left: 30px; width: 20%; position: absolute; } .help_text { font-size: 0.7em; left: 30px; width: 20%; position: absolute; }
.attachments { float: right; margin-top: 0.4em; display: block; clear: both; } .attachments { float: right; margin-top: 0.4em; display: block; clear: both; }
table.listing, .pagination { width: 90%; margin: auto; }
table.listing thead td { font-weight: bold; border-bottom: 1px solid black; }
#addForm { margin: auto; width: 50%; padding 4em; } #addForm { margin: auto; width: 50%; padding 4em; }
#add_attach { cursor: pointer; } #add_attach { cursor: pointer; }
......
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