add detail
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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/<str:id>/detail/",
|
||||
ResolutionDetailView.as_view(),
|
||||
name="resolution_detail",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user