diff --git a/fet2020/finance/forms.py b/fet2020/finance/forms.py index d3945d45..3e3b20da 100644 --- a/fet2020/finance/forms.py +++ b/fet2020/finance/forms.py @@ -354,6 +354,9 @@ class ResolutionCreateForm(forms.ModelForm): self.fields["option"].autofocus = True + self.fields["voting_text"].cols = 30 + self.fields["voting_text"].rows = 3 + class ResolutionUpdateForm(forms.ModelForm): class Meta: @@ -381,6 +384,15 @@ class ResolutionUpdateForm(forms.ModelForm): self.fields["option"].autofocus = True + # Config for textarea of comment. Calc rows for a better view. + self.fields["voting_text"].cols = 30 + rows = ( + len(kwargs["instance"].voting_text) / 90 + + kwargs["instance"].voting_text.count("\n") + + 1 + ) + self.fields["voting_text"].rows = rows + class BillInlineForm(forms.ModelForm): class Meta: diff --git a/fet2020/finance/urls.py b/fet2020/finance/urls.py index 5fe73b96..c16cd090 100644 --- a/fet2020/finance/urls.py +++ b/fet2020/finance/urls.py @@ -7,6 +7,7 @@ from .views import ( BillListView, BillUpdateView, ResolutionCreateView, + ResolutionDetailView, ResolutionListView, ResolutionUpdateView, ) @@ -29,4 +30,9 @@ urlpatterns = [ ResolutionUpdateView.as_view(), name="resolution_update", ), + path( + "resolutions//detail/", + ResolutionDetailView.as_view(), + name="resolution_detail", + ), ] diff --git a/fet2020/finance/views.py b/fet2020/finance/views.py index 07b555bb..72b592f2 100644 --- a/fet2020/finance/views.py +++ b/fet2020/finance/views.py @@ -3,9 +3,11 @@ from django.db.models import Q from django.shortcuts import redirect from django.urls import reverse, reverse_lazy from django.views.generic import ListView, TemplateView +from django.views.generic.detail import DetailView from django.views.generic.edit import CreateView, UpdateView from fet2020.utils import add_log_action +from posts.models import FetMeeting from .forms import ( BillCreateForm, @@ -120,6 +122,21 @@ class ResolutionCreateView(LoginRequiredMixin, CreateView): return super().form_valid(form) +class ResolutionDetailView(LoginRequiredMixin, DetailView): + model = Resolution + pk_url_kwarg = "id" + template_name = "finance/resolution_detail.html" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + context["fetmeeting"] = ( + FetMeeting.objects.get_queryset().filter(date=self.object.date).first() + ) + + return context + + class ResolutionListView(LoginRequiredMixin, ListView): model = Resolution template_name = "finance/resolution_list.html" diff --git a/fet2020/templates/finance/resolution_detail.html b/fet2020/templates/finance/resolution_detail.html new file mode 100644 index 00000000..8a25af81 --- /dev/null +++ b/fet2020/templates/finance/resolution_detail.html @@ -0,0 +1,60 @@ +{% extends 'base.html' %} + +{% block title %}Beschluss {{ object.id }}{% endblock %} + +{% block content %} + +
+

Beschluss {{ object.id }}

+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ {% if fetmeeting %} +
+ +
+ {% endif %} +
+ +
+
+
+
+ + Beschluss bearbeiten + +
+
+{% endblock %} diff --git a/fet2020/templates/finance/resolution_list.html b/fet2020/templates/finance/resolution_list.html index 4b216edf..d152dac4 100644 --- a/fet2020/templates/finance/resolution_list.html +++ b/fet2020/templates/finance/resolution_list.html @@ -10,14 +10,14 @@ Beschluss eingeben -
+
- + @@ -27,8 +27,8 @@ {% for result in object_list %} - - + +
Nummer BezeichnungAbstimmungstext Abstimmungsverhalten Beschluss
{{ result.id }}{{ result.name }}{{ result.voting_text }}{{ result.name }} {{ result.voting }} {{ result.get_option_display }} @@ -39,7 +39,7 @@
- + {% if is_paginated %}
@@ -49,11 +49,11 @@ Zurück 1 {% endif %} - + {{ page_obj.number }} - + {% if page_obj.has_next %} {{ page_obj.paginator.num_pages }} Vor