From baa2dcc38b9c84347f9bdf90513d9f385dd63357 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Mon, 20 Mar 2017 00:16:33 +0100 Subject: [PATCH] Zwischencommit --- dnmgmt/settings.py | 2 +- rrequests/forms.py | 2 +- rrequests/models.py | 2 +- rrequests/views.py | 7 ++- templates/base.html | 2 +- templates/dncore/dashboard.html | 14 ++--- templates/index.html | 17 ++---- templates/rrequests/list.html | 45 ++++++++++++---- templates/rrequests/request_create.html | 2 +- templates/rrequests/request_detail.html | 16 ++++-- templates/whoisdb/contact_detail.html | 2 +- templates/whoisdb/create_overview.html | 30 +++++++++++ templates/whoisdb/handle_show.html | 34 ++++++++++++ templates/whoisdb/handle_table_row.html | 10 ++-- templates/whoisdb/maintainer_detail.html | 8 ++- templates/whoisdb/obj_create.html | 2 +- templates/whoisdb/obj_delete.html | 8 +-- templates/whoisdb/overview.html | 20 +++++-- whoisdb/forms.py | 4 +- whoisdb/helpers.py | 33 ++++++++++++ whoisdb/models.py | 35 +++++++++++-- whoisdb/models_crap.py | 67 ------------------------ whoisdb/templatetags/__init__.py | 0 whoisdb/templatetags/handletags.py | 37 +++++++++++++ whoisdb/urls.py | 8 +++ whoisdb/views.py | 30 +++++++++-- 26 files changed, 304 insertions(+), 133 deletions(-) create mode 100644 templates/whoisdb/create_overview.html create mode 100644 templates/whoisdb/handle_show.html create mode 100644 whoisdb/helpers.py delete mode 100644 whoisdb/models_crap.py create mode 100644 whoisdb/templatetags/__init__.py create mode 100644 whoisdb/templatetags/handletags.py diff --git a/dnmgmt/settings.py b/dnmgmt/settings.py index f5de88c..80944e6 100644 --- a/dnmgmt/settings.py +++ b/dnmgmt/settings.py @@ -26,7 +26,7 @@ SECRET_KEY = 'b96*sagnglcd8xe&8&cm6g-(onalk(ps3u!c1l3#_(-w64w35)' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ["*"] # Application definition diff --git a/rrequests/forms.py b/rrequests/forms.py index 00b1528..ad60c25 100644 --- a/rrequests/forms.py +++ b/rrequests/forms.py @@ -26,7 +26,7 @@ class RequestForm(forms.Form): def clean(self): cleaned_data = super(RequestForm, self).clean() - if not forms.errors: + if not self.errors: mnts = self._user.maintainer_set.all() if cleaned_data['applicant'] in mnts and cleaned_data['provider'] in mnts: raise forms.ValidationError("You could request resources from yourself, but this would actually not make that much sense.") diff --git a/rrequests/models.py b/rrequests/models.py index 7af31b0..871ab8f 100644 --- a/rrequests/models.py +++ b/rrequests/models.py @@ -31,7 +31,7 @@ class Request(models.Model): return reverse("rrequests:show", args=(self.pk,)) def __str__(self): - return "(%s -> %s) [%s] %s" % (self.applicant, self.provider, self.state, self.subject) + return "(%s -> %s) [%s] %s" % (self.applicant, self.provider, self.status, self.subject) class RequestMessage(models.Model): diff --git a/rrequests/views.py b/rrequests/views.py index 4d55df9..bd21090 100644 --- a/rrequests/views.py +++ b/rrequests/views.py @@ -15,8 +15,9 @@ def listRequests(request): mnts = request.user.maintainer_set.all() requestedFromMe = Request.objects.filter(applicant=mnts) requestedToMe = Request.objects.filter(provider__in=mnts) + requests = (requestedFromMe | requestedToMe).order_by("-lastAction") - return render(request, "rrequests/list.html", {"requestedFromMe": requestedFromMe, "requestedToMe": requestedToMe}) + return render(request, "rrequests/list.html", {"requests": requests, "requestedFromMe": requestedFromMe, "requestedToMe": requestedToMe}) class RrequestCreate(LoginRequiredMixin, FormView): @@ -79,6 +80,10 @@ def rrequestDetail(request, pk): msg.save() + if "createdResources" in form.cleaned_data and \ + form.cleaned_data['createdResources'].strip() != "": + reqObj.grantedResources = form.cleaned_data["createdResources"].strip() + reqObj.lastAction = timezone.now() reqObj.save() diff --git a/templates/base.html b/templates/base.html index fc2f371..f8ac19c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -52,7 +52,7 @@