diff --git a/bt/forms.py b/bt/forms.py index f571beb1832393f6563d64ba07a720b7837c07bc..d8941f0307ca0f732375ea8ab00365158b5ac9cc 100644 --- a/bt/forms.py +++ b/bt/forms.py @@ -22,6 +22,7 @@ class AddViolation(forms.Form): contract = forms.CharField(required=True, max_length=256, help_text=_('The specific contract at the ISP provider. (please be as specific as possible)')) comment = forms.CharField(required=True, widget=AdvancedEditor(), help_text=_('Please describe the symptoms you are experiencing. What service or site, or person is unavailable or seems artificially slowed down.')) email = forms.EmailField(required=True, help_text=_("We need your email to validate your report. We're not storing the email later on.")) + nick = forms.CharField(required=False, help_text=_("We need your some name to identify you later on.")) attachments = MultiFileField(required=False, help_text=_("Attach screenshot, document or any other relevant information.")) resource = forms.ChoiceField(required=False, choices=(('',''),)+tuple(sorted(RESOURCES,key=itemgetter(1))), help_text=_('The what is the affected resource.')) resource_name = forms.CharField(required=False, max_length=4096, help_text=_('Please specify the name of the affected resource.')) diff --git a/bt/models.py b/bt/models.py index 3bbf50a6bdd6a990cdab24025b8787176994b63d..eff7cfc1bb8677a85593a76234ceb605ffb10d08 100644 --- a/bt/models.py +++ b/bt/models.py @@ -53,6 +53,7 @@ class Violation(models.Model): operator = models.CharField(max_length=256) contract = models.CharField(max_length=256) resource = models.CharField(max_length=20, choices=RESOURCES) + resource_name = models.CharField(max_length=4096) type = models.CharField(max_length=20, choices=TYPES) media = models.CharField( max_length=20, choices=MEDIA) temporary = models.BooleanField( ) @@ -61,9 +62,10 @@ class Violation(models.Model): loophole = models.BooleanField() class Comment(models.Model): - submitter = models.EmailField() + submitter_email = models.EmailField() + submitter_name = models.CharField(max_length=20) comment = models.TextField() - timestamp = models.DateField() + timestamp = models.DateTimeField() violation = models.ForeignKey(Violation) class Attachment(models.Model): diff --git a/bt/views.py b/bt/views.py index 62f656e5fd6a12714133db354038955300cfc8d1..6056615a83e6d90476dc15c4031be7bfde74cf3a 100644 --- a/bt/views.py +++ b/bt/views.py @@ -1,10 +1,11 @@ from forms import AddViolation from django.http import HttpResponse, HttpResponseRedirect, Http404 -from django.shortcuts import render_to_response +from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.core.files import File from django.conf import settings from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger +from django.core.exceptions import ObjectDoesNotExist from models import Violation, Attachment, Comment from tempfile import mkstemp from datetime import datetime @@ -29,7 +30,8 @@ def add(request): v.save() c = Comment( comment=form.cleaned_data['comment'], - submitter=form.cleaned_data['email'], + submitter_email=form.cleaned_data['email'], + submitter_name=form.cleaned_data['nick'], timestamp=datetime.now(), violation=v, ) @@ -68,3 +70,7 @@ def index(request): violations = paginator.page(paginator.num_pages) return render_to_response('list.html', {"violations": violations}) + +def view(request,id): + v = get_object_or_404(Violation, pk=id) + return render_to_response('view.html', { 'v': v, }) diff --git a/media/css/style.css b/media/css/style.css index a30b29d6bb30714221cca716370ef54ea10dc50e..2261fb0c636148d988f71a4b5b390f86aff20fb3 100644 --- a/media/css/style.css +++ b/media/css/style.css @@ -2,15 +2,23 @@ body { border: 0; padding: 0; font-family: Verdana,Arial,Helvetica,sans-serif; } img { border: 0; } h1, h2, h3, h4, div, ul { padding: 0; margin: 0; } h2 { margin: auto; width: 50%; padding 4em; } +li { list-style: none; } + .fieldWrapper { margin: 1em; width: 100%; } .fieldWrapper label { width: 200px; display: inline-block; } .help_text { font-size: 0.7em; left: 30px; width: 20%; position: absolute; } .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; } +.comment-node { margin: 1em; padding-bottom: 0.4em; border-bottom: 1px solid black; width: 500px;} +.comment { margin: 1em; } +.atttachsg { margin: 1em; } #addForm { margin: auto; width: 50%; padding 4em; } #add_attach { cursor: pointer; } #show_optionals { text-decoration: underline; color: blue; cursor: pointer; clear: both; } #optional { clear: both; } + +table.listing, .pagination { width: 90%; margin: auto; } +table.listing thead td { font-weight: bold; border-bottom: 1px solid black; } +dt { display: inline-block; width: 14em; } +dd { display: inline; } diff --git a/templates/base.html b/templates/base.html index cf56dfef52ae1102199aca6b6bf4fddbbce3a740..310faadec99c20d2462f2f3837eef947b4b896ad 100644 --- a/templates/base.html +++ b/templates/base.html @@ -18,6 +18,8 @@
+ {%for a in c.attachment_set.all%} +- {{a.storage.name}}
+ {%endfor%}
+
+