From 0eb21eeb5cb1e71cba9f9c489dd4d1b79bddb0ab Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Fri, 27 Dec 2019 12:35:06 +0100 Subject: [PATCH] Refactor --- schoolapps/fibu/decorators.py | 2 +- schoolapps/fibu/forms.py | 83 +++++++++-------- schoolapps/fibu/models.py | 70 ++++++++------- .../fibu/templates/fibu/booking/index.html | 25 +++--- schoolapps/fibu/templates/fibu/index.html | 28 +++--- schoolapps/fibu/tests.py | 3 - schoolapps/fibu/views.py | 90 ++++--------------- 7 files changed, 119 insertions(+), 182 deletions(-) delete mode 100644 schoolapps/fibu/tests.py diff --git a/schoolapps/fibu/decorators.py b/schoolapps/fibu/decorators.py index 3c944913e..63210079b 100644 --- a/schoolapps/fibu/decorators.py +++ b/schoolapps/fibu/decorators.py @@ -4,7 +4,7 @@ from django.contrib.auth import REDIRECT_FIELD_NAME from .models import Booking -# prevent to show aub details from foreign users +# prevent to show booking details from foreign users def check_own_booking_verification(user): return Booking.objects.all().filter(created_by=user) diff --git a/schoolapps/fibu/forms.py b/schoolapps/fibu/forms.py index 5e4bf2cbe..a8cba150e 100644 --- a/schoolapps/fibu/forms.py +++ b/schoolapps/fibu/forms.py @@ -1,15 +1,15 @@ from django import forms -from django.core.exceptions import ValidationError -from django.utils import timezone -from datetime import datetime from django.contrib.auth.models import User from material import Layout, Row, Fieldset + from .models import YEARLIST, Booking, Costcenter, Account, status_choices + class EditBookingForm(forms.ModelForm): - description = forms.CharField(label='Beschreibung - Was soll gekauft werden?') - planned_amount = forms.IntegerField(label='Erwarteter Betrag - Welcher Betrag ist erforderlich (in Euro ohne Komma)?') - justification = forms.CharField(label='Begründung - Begründe ggf. deinen Antrag.', required=False) + description = forms.CharField(label='Beschreibung – Was soll angeschafft werden?') + planned_amount = forms.IntegerField( + label='Erwarteter Betrag – Welcher Betrag ist erforderlich (in Euro, ohne Komma)?') + justification = forms.CharField(label='Begründung – Begründe ggf. deinen Antrag.', required=False) layout = Layout(Row('description', 'planned_amount'), Row('justification')) @@ -19,40 +19,40 @@ class EditBookingForm(forms.ModelForm): class CheckBookingForm(forms.ModelForm): - accounts = Account.objects.filter().order_by('costcenter','name') + accounts = Account.objects.filter().order_by('costcenter', 'name') account = forms.ModelChoiceField(queryset=accounts, label='Buchungskonto') class Meta: model = Account - fields = ('account', ) + fields = ('account',) + class BookBookingForm(forms.ModelForm): - accounts = Account.objects.filter().order_by('costcenter','name') - user = User.objects.filter() - description = forms.CharField(label='Beschreibung') - planned_amount = forms.IntegerField(label='Erwarteter Betrag (ganze Euro)') - justification = forms.CharField(label='Begründung', required=False) - account = forms.ModelChoiceField(queryset=accounts, label='Buchungskonto') - contact = forms.ModelChoiceField(queryset=user, label='Kontakt') - invoice_date = forms.DateField(label='Rechnungsdatum') - invoice_number = forms.CharField(label='Rechnungsnummer') - firma = forms.CharField(label='Firma') - amount = forms.DecimalField(max_digits=9, decimal_places=2, label='Betrag') + accounts = Account.objects.filter().order_by('costcenter', 'name') + user = User.objects.filter() + description = forms.CharField(label='Beschreibung') + planned_amount = forms.IntegerField(label='Erwarteter Betrag (ganze Euro)') + justification = forms.CharField(label='Begründung', required=False) + account = forms.ModelChoiceField(queryset=accounts, label='Buchungskonto') + contact = forms.ModelChoiceField(queryset=user, label='Kontakt') + invoice_date = forms.DateField(label='Rechnungsdatum') + invoice_number = forms.CharField(label='Rechnungsnummer') + firma = forms.CharField(label='Firma') + amount = forms.DecimalField(max_digits=9, decimal_places=2, label='Betrag') submission_date = forms.DateField(label='Bearbeitungsdatum') - payout_number = forms.IntegerField(label='Auszahlungsnummer') - booking_date = forms.DateField(label='Buchungsdatum') - maturity = forms.DateField(label='Fälligkeit') - upload = forms.FileField(label='Scan der Rechnung', required=False) - status = forms.ChoiceField(choices=status_choices, label='Status') - + payout_number = forms.IntegerField(label='Auszahlungsnummer') + booking_date = forms.DateField(label='Buchungsdatum') + maturity = forms.DateField(label='Fälligkeit') + upload = forms.FileField(label='Scan der Rechnung', required=False) + status = forms.ChoiceField(choices=status_choices, label='Status') layout = Layout(Row('description', 'justification', 'contact'), Row('account', 'status', 'planned_amount'), Fieldset('Details', - Row('firma', 'invoice_number', 'amount'), - Row('invoice_date', 'maturity', 'submission_date', 'booking_date'), - Row('payout_number', 'upload') - ) + Row('firma', 'invoice_number', 'amount'), + Row('invoice_date', 'maturity', 'submission_date', 'booking_date'), + Row('payout_number', 'upload') + ) ) class Meta: @@ -63,22 +63,22 @@ class BookBookingForm(forms.ModelForm): class EditCostcenterForm(forms.ModelForm): - name = forms.CharField(max_length=30, label='Kostenstelle') - year = forms.ChoiceField(choices=YEARLIST, label='Jahr') + name = forms.CharField(max_length=30, label='Kostenstelle') + year = forms.ChoiceField(choices=YEARLIST, label='Jahr') - layout = Layout(Row('name','year')) + layout = Layout(Row('name', 'year')) - class Meta: - model = Costcenter - fields = ('id', 'name', 'year') + class Meta: + model = Costcenter + fields = ('id', 'name', 'year') class EditAccountForm(forms.ModelForm): - name = forms.CharField(max_length=30, label='Buchungskonto') - costcenterlist = Costcenter.objects.filter() - costcenter = forms.ModelChoiceField(queryset=costcenterlist, label='Kostenstelle') - income = forms.BooleanField(label='Budget-/Einnanhmekonto', required=False) - budget = forms.IntegerField(label='Budget') + name = forms.CharField(max_length=30, label='Buchungskonto') + costcenterlist = Costcenter.objects.filter() + costcenter = forms.ModelChoiceField(queryset=costcenterlist, label='Kostenstelle') + income = forms.BooleanField(label='Budget-/Einnanhmekonto', required=False) + budget = forms.IntegerField(label='Budget') layout = Layout(Row('name', 'costcenter', 'income', 'budget')) @@ -86,7 +86,6 @@ class EditAccountForm(forms.ModelForm): model = Account fields = ('id', 'name', 'costcenter', 'income', 'budget') - # # class AcquisitionForm(forms.ModelForm): # # Cost_center choices @@ -123,5 +122,3 @@ class EditAccountForm(forms.ModelForm): # class Meta: # model = Booking # fields = ('cost_center', 'description', 'planned_amount') - - diff --git a/schoolapps/fibu/models.py b/schoolapps/fibu/models.py index 1e460fe2b..4d95b3c3f 100644 --- a/schoolapps/fibu/models.py +++ b/schoolapps/fibu/models.py @@ -1,10 +1,12 @@ from django.db import models from django.contrib.auth.models import User -YEARLIST = [(2020,'2020'), - (2021,'2021'), - (2022,'2022'), - (2023,'2023')] +# TODO: Make dynamic +YEARLIST = [(2020, '2020'), + (2021, '2021'), + (2022, '2022'), + (2023, '2023')] + class Status: def __init__(self, name, style_class): @@ -12,7 +14,7 @@ class Status: self.style_class = style_class def __str__(self): - return "%s" % (self.name) + return self.name status_list = [ @@ -27,61 +29,61 @@ status_list = [ status_choices = [(x, val.name) for x, val in enumerate(status_list)] - class Costcenter(models.Model): # Kostenstellen z.B. Schulträger-konsumtiv, Schulträger-investiv, Elternverein, ... name = models.CharField(max_length=30) year = models.IntegerField(default=2019, choices=YEARLIST, verbose_name="Jahr") + def __str__(self): - return "%s" % (self.name) + return self.name class Meta: permissions = [ ('manage_costcenter', 'Can manage costcenter'), ] + class Account(models.Model): # Buchungskonten, z.B. Fachschaften, Sekretariat, Schulleiter, Kopieren, Tafelnutzung - name = models.CharField(max_length=20, default='') - costcenter = models.ForeignKey(to=Costcenter, on_delete=models.CASCADE, default='') - income = models.BooleanField(default=False) # True, wenn es sich um ein Einnahmekonto handelt - budget = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) - saldo = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) - rest = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) + name = models.CharField(max_length=20, default='') + costcenter = models.ForeignKey(to=Costcenter, on_delete=models.CASCADE, default='') + income = models.BooleanField(default=False) # True, wenn es sich um ein Einnahmekonto handelt + budget = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) + saldo = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) + rest = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) def __str__(self): - return "%s: %s" % (self.costcenter, self.name) + return "{}: {}".format(self.costcenter, self.name) class Meta: permissions = [ ('manage_account', 'Can manage account'), ] + class Booking(models.Model): - account = models.ForeignKey(to=Account, on_delete=models.SET_NULL, blank=True, null=True) - contact = models.ForeignKey(to=User, related_name='bookings', on_delete=models.SET_NULL - , verbose_name="Erstellt von", blank=True, null=True) - invoice_date = models.DateField(default='2000-12-31') - invoice_number = models.CharField(max_length=20, default='0') - firma = models.CharField(max_length=30, default='') - description = models.CharField(max_length=50) - amount = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) - planned_amount = models.IntegerField() + account = models.ForeignKey(to=Account, on_delete=models.SET_NULL, blank=True, null=True) + contact = models.ForeignKey(to=User, related_name='bookings', on_delete=models.SET_NULL + , verbose_name="Erstellt von", blank=True, null=True) + invoice_date = models.DateField(default='2000-12-31') + invoice_number = models.CharField(max_length=20, default='0') + firma = models.CharField(max_length=30, default='') + description = models.CharField(max_length=50) + amount = models.DecimalField(max_digits=9, decimal_places=2, default=0.00) + planned_amount = models.IntegerField() submission_date = models.DateField(default='2000-12-31') - justification = models.CharField(max_length=2000, blank=True, null=True) - payout_number = models.IntegerField(default=0) - booking_date = models.DateField(default='2000-12-31') - maturity = models.DateField(default='2000-12-31') - upload = models.FileField(upload_to='uploads/fibu/%Y/', default=None, blank=True, null=True) - status = models.IntegerField(default=0, choices=status_choices, verbose_name="Status") - - - def getStatus(self): + justification = models.CharField(max_length=2000, blank=True, null=True) + payout_number = models.IntegerField(default=0) + booking_date = models.DateField(default='2000-12-31') + maturity = models.DateField(default='2000-12-31') + upload = models.FileField(upload_to='uploads/fibu/%Y/', default=None, blank=True, null=True) + status = models.IntegerField(default=0, choices=status_choices, verbose_name="Status") + + def get_status(self): return status_list[self.status] - class Meta: permissions = [ ('manage_booking', 'Can manage bookings'), ('request_booking', 'Can request a booking'), - ] \ No newline at end of file + ] diff --git a/schoolapps/fibu/templates/fibu/booking/index.html b/schoolapps/fibu/templates/fibu/booking/index.html index 1e0d3c758..de52abf85 100755 --- a/schoolapps/fibu/templates/fibu/booking/index.html +++ b/schoolapps/fibu/templates/fibu/booking/index.html @@ -10,26 +10,27 @@ {% else %} <a href="{% url 'booking' 1 %}" class="waves-effect waves-light btn grey right">Zum Archiv</a> {% endif %} - <h4>Buchungen</h4> + <h4>Buchungen</h4> <div class="collection"> {% for booking in bookings %} - <a href="/fibu/booking/book/{{ booking.id }}" class="collection-item row"> + <a href="/fibu/booking/book/{{ booking.id }}" class="collection-item row"> <span class="col s5 m5">{{ booking.description }}</span> <span class="col s1 m1 right-align">{{ booking.planned_amount }} €</span> <span class="col s3 m3">{{ booking.account }}</span> <span class="col s1 m1 center">{{ booking.contact }}</span> - <span class="col s1 m1 badge new center-align {{ booking.getStatus.style_class }}"> - {{ booking.getStatus.name }} + <span class="col s1 m1 badge new center-align {{ booking.get_status.style_class }}"> + {{ booking.get_status.name }} </span> <span class="col s1 m1"> - {% if booking.status < 2 %} - <form method="POST" class="left"> - {% csrf_token %} - <input type="hidden" value="{{ booking.id }}" name="booking-id"> - <button type="submit" onclick="return confirm('Wollen Sie den Antrag wirklich löschen?')" - name="cancel" class="waves-effect waves-light btn-flat btn-flat-medium" - title="Löschen"> - <i class="material-icons center red-text">cancel</i> + {% if booking.status < 2 %} + <form method="POST" class="left"> + {% csrf_token %} + <input type="hidden" value="{{ booking.id }}" name="booking-id"> + <button type="submit" + onclick="return confirm('Wollen Sie den Antrag wirklich löschen?')" + name="cancel" class="waves-effect waves-light btn-flat btn-flat-medium" + title="Löschen"> + <i class="material-icons center red-text">cancel</i> </button> </form> {% endif %} diff --git a/schoolapps/fibu/templates/fibu/index.html b/schoolapps/fibu/templates/fibu/index.html index fee5f82a9..850c7f49b 100755 --- a/schoolapps/fibu/templates/fibu/index.html +++ b/schoolapps/fibu/templates/fibu/index.html @@ -15,23 +15,23 @@ </button> </form> - <h4>Laufende Anträge</h4> + <h4>Laufende Anträge</h4> <div class="collection"> {% for booking in bookings %} <div class="collection-item row"> - <span class="col s12 m7">{{ booking.description }}</span> - <span class="col s12 m1 right-align">{{ booking.planned_amount }} €</span> - <span class="col s12 m1 badge new center-align {{ booking.getStatus.style_class }}">{{ booking.getStatus.name }}</span> - <span class="col s12 m3"> - {% if booking.status == 0 %} - <form action="{% url 'booking_edit' booking.id %}" class="left"> - {% csrf_token %} - <input type="hidden" value="{{ booking.id }}" name="booking-id"> - <button type="submit" name="edit" - class="waves-effect waves-light btn-flat btn-flat-medium" title="Bearbeiten"> - <i class="material-icons center green-text">create</i> - </button> - </form> + <span class="col s12 m7">{{ booking.description }}</span> + <span class="col s12 m1 right-align">{{ booking.planned_amount }} €</span> + <span class="col s12 m1 badge new center-align {{ booking.get_status.style_class }}">{{ booking.get_status.name }}</span> + <span class="col s12 m3"> + {% if booking.status == 0 %} + <form action="{% url 'booking_edit' booking.id %}" class="left"> + {% csrf_token %} + <input type="hidden" value="{{ booking.id }}" name="booking-id"> + <button type="submit" name="edit" + class="waves-effect waves-light btn-flat btn-flat-medium" title="Bearbeiten"> + <i class="material-icons center green-text">create</i> + </button> + </form> {% endif %} {% if booking.status == 0 or booking.status == 1 %} <form action="" method="POST" class="left"> diff --git a/schoolapps/fibu/tests.py b/schoolapps/fibu/tests.py deleted file mode 100644 index 7ce503c2d..000000000 --- a/schoolapps/fibu/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/schoolapps/fibu/views.py b/schoolapps/fibu/views.py index 8a66ac477..bb4b76623 100644 --- a/schoolapps/fibu/views.py +++ b/schoolapps/fibu/views.py @@ -5,7 +5,7 @@ from django.shortcuts import render, redirect, get_object_or_404 from .models import Booking, Costcenter, Account from .filters import BookingFilter from .forms import EditBookingForm, CheckBookingForm, BookBookingForm, EditCostcenterForm, EditAccountForm -from .decorators import check_own_booking + @login_required @permission_required('fibu.request_booking') @@ -17,11 +17,7 @@ def index(request): booking = Booking.objects.get(id=booking_id) if 'cancel' in request.POST: booking.delete() -# a = Activity(user=aub_user, title="Antrag auf Unterrichtsbefreiung gelöscht", -# description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + -# "für den Zeitraum von {} bis {} gelöscht.".format( -# aub.from_date, aub.to_date), app=AubConfig.verbose_name) -# a.save() + print('Eintrag gelöscht') return redirect('fibu_index') elif 'ordered' in request.POST: @@ -40,15 +36,10 @@ def index(request): description = form.cleaned_data['description'] planned_amount = form.cleaned_data['planned_amount'] justification = form.cleaned_data['justification'] - booking = Booking(description=description, planned_amount=planned_amount, contact=request.user, justification=justification) + booking = Booking(description=description, planned_amount=planned_amount, contact=request.user, + justification=justification) booking.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung gestellt", - # description="Sie haben einen Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} gestellt.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() - # return redirect('fibu_make_booking') return redirect('fibu_index') bookings = Booking.objects.filter(contact=fibu_user).order_by('status') @@ -66,25 +57,19 @@ def edit(request, id): form = EditBookingForm(request.POST, instance=booking) if form.is_valid(): form.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung verändert", - # description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} bearbeitet.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() + return redirect(reverse('fibu_index')) context = {'form': form} return render(request, template, context) - - @login_required @permission_required('fibu.manage_booking') def check(request): if request.method == 'POST': if 'booking-id' in request.POST: booking_id = request.POST['booking-id'] - #booking = Booking.objects.get(id=booking_id) + # booking = Booking.objects.get(id=booking_id) if 'allow' in request.POST: Booking.objects.filter(id=booking_id).update(status=1) account = request.POST['account'] @@ -92,24 +77,13 @@ def check(request): Booking.objects.filter(id=booking_id).update(account=account) elif 'deny' in request.POST: Booking.objects.filter(id=booking_id).update(status=2) - # Notify user - # register_notification(title="Ihr Antrag auf Unterrichtsbefreiung wurde abgelehnt", - # description="Ihr Antrag auf Unterrichtsbefreiung vom {}, {} Uhr bis {}, {} Uhr wurde von der " - # "Schulleitung abgelehnt. Für weitere Informationen kontaktieren Sie " - # "bitte die Schulleitung." - # .format(formats.date_format(aub.from_date), - # formats.time_format(aub.from_time), - # formats.date_format(aub.to_date), - # formats.time_format(aub.to_time)), - # app=AubConfig.verbose_name, user=aub.created_by, - # link=request.build_absolute_uri(reverse('aub_details', args=[aub.id])) - # ) booking_list = Booking.objects.filter(status=0).order_by('submission_date') bookings = BookingFilter(request.GET, queryset=booking_list) form = CheckBookingForm() return render(request, 'fibu/booking/check.html', {'filter': bookings, 'form': form}) + @login_required @permission_required('fibu.manage_booking') def booking(request, archiv): @@ -120,6 +94,7 @@ def booking(request, archiv): context = {'bookings': bookings, 'archiv': archiv} return render(request, 'fibu/booking/index.html', context) + @login_required @permission_required('fibu.manage_booking') def book(request, id): @@ -130,15 +105,12 @@ def book(request, id): form = BookBookingForm(request.POST, request.FILES, instance=booking) if form.is_valid(): form.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung verändert", - # description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} bearbeitet.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() + return redirect(reverse('booking')) context = {'form': form} return render(request, template, context) + @login_required @permission_required('fibu.manage_booking') def new_booking(request): @@ -148,11 +120,7 @@ def new_booking(request): form = BookBookingForm(request.POST, request.FILES) if form.is_valid(): form.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung verändert", - # description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} bearbeitet.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() + return redirect(reverse('booking')) context = {'form': form} return render(request, template, context) @@ -167,11 +135,7 @@ def costcenter(request): costcenter = Costcenter.objects.get(id=costcenter_id) if 'cancel' in request.POST: costcenter.delete() -# a = Activity(user=aub_user, title="Antrag auf Unterrichtsbefreiung gelöscht", -# description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + -# "für den Zeitraum von {} bis {} gelöscht.".format( -# aub.from_date, aub.to_date), app=AubConfig.verbose_name) -# a.save() + print('Eintrag gelöscht') return redirect('costcenter') print('Edit-Form erstellt ############# form.is_valid:', form.is_valid()) @@ -186,12 +150,6 @@ def costcenter(request): costcenter = Costcenter(name=name, year=year) costcenter.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung gestellt", - # description="Sie haben einen Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} gestellt.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() - # return redirect('fibu_make_booking') return redirect('costcenter') costcenterlist = Costcenter.objects.filter() context = {'costcenterlist': costcenterlist, 'form': form} @@ -209,16 +167,12 @@ def costcenter_edit(request, id): print('\n\n\nBLUBB', form) if form.is_valid(): form.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung verändert", - # description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} bearbeitet.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() return redirect(reverse('costcenter')) context = {'form': form} return render(request, template, context) + @login_required @permission_required('fibu.manage_account') def account(request): @@ -228,11 +182,7 @@ def account(request): account = Account.objects.get(id=account_id) if 'cancel' in request.POST: account.delete() -# a = Activity(user=aub_user, title="Antrag auf Unterrichtsbefreiung gelöscht", -# description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + -# "für den Zeitraum von {} bis {} gelöscht.".format( -# aub.from_date, aub.to_date), app=AubConfig.verbose_name) -# a.save() + print('Eintrag gelöscht') return redirect('account') print('Edit-Form erstellt ############# form.is_valid:', form.is_valid()) @@ -249,12 +199,6 @@ def account(request): account = Account(name=name, costcenter=costcenter, income=income, budget=budget) account.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung gestellt", - # description="Sie haben einen Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} gestellt.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() - # return redirect('fibu_make_booking') return redirect('account') accounts = Account.objects.filter() context = {'accounts': accounts, 'form': form} @@ -272,11 +216,6 @@ def account_edit(request, id): print('\n\n\nBLUBB', form) if form.is_valid(): form.save() - # a = Activity(user=request.user, title="Antrag auf Unterrichtsbefreiung verändert", - # description="Sie haben Ihren Antrag auf Unterrichtsbefreiung " + - # "für den Zeitraum von {} bis {} bearbeitet.".format( - # aub.from_date, aub.to_date), app=AubConfig.verbose_name) - # a.save() return redirect(reverse('account')) context = {'form': form} @@ -288,6 +227,7 @@ def account_edit(request, id): def reports(request): return render(request, 'fibu/reports/index.html') + @login_required @permission_required('fibu.manage_booking') def expenses(request): -- GitLab