Skip to content

Commit

Permalink
Merge pull request #812 from hackerspace-ntnu/itemloan-templates-not-…
Browse files Browse the repository at this point in the history
…found

use base detail view with deletion mixin to delete loan applications
  • Loading branch information
michaelbrusegard authored Apr 11, 2024
2 parents d4023a8 + 5c9aa13 commit e6f771f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 33 deletions.
10 changes: 9 additions & 1 deletion inventory/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-03 19:21+0200\n"
"POT-Creation-Date: 2024-04-11 00:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -141,3 +141,11 @@ msgstr "Loan applications"
#: inventory/templates/inventory/loan_applications.html:8
msgid "Oversikt over lånesøknader"
msgstr "Overview of loan applications"

#: inventory/views/item_loan.py:107
msgid "Lånesøknaden er avslått"
msgstr "Loan applications is denied"

#: inventory/views/item_loan.py:124
msgid "Lånesøknaden er lukket"
msgstr "Loan application is closed"
10 changes: 9 additions & 1 deletion inventory/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-03 19:21+0200\n"
"POT-Creation-Date: 2024-04-11 00:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -136,3 +136,11 @@ msgstr ""
#: inventory/templates/inventory/loan_applications.html:8
msgid "Oversikt over lånesøknader"
msgstr ""

#: inventory/views/item_loan.py:107
msgid "Lånesøknaden er avslått"
msgstr ""

#: inventory/views/item_loan.py:124
msgid "Lånesøknaden er lukket"
msgstr ""
19 changes: 8 additions & 11 deletions inventory/views/item_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
from django.shortcuts import get_object_or_404
from django.urls import reverse, reverse_lazy
from django.utils import timezone
from django.views.generic import (
CreateView,
DeleteView,
DetailView,
ListView,
TemplateView,
)
from django.utils.translation import gettext as _
from django.views.generic import CreateView, DetailView, ListView, TemplateView
from django.views.generic.dates import BaseDetailView
from django.views.generic.edit import DeletionMixin

from inventory.models.item import Item
from inventory.models.item_loan import ItemLoan
Expand Down Expand Up @@ -97,12 +94,12 @@ def get(self, request, pk=None, **kwargs):
)


class ItemLoanDeclineView(PermissionRequiredMixin, DeleteView):
class ItemLoanDeclineView(BaseDetailView, PermissionRequiredMixin, DeletionMixin):
"""Endpoint for deleting/rejecting loans"""

model = ItemLoan
permission_required = "inventory.delete_itemloan"
success_message = "Lånesøknaden er avslått"
success_message = _("Lånesøknaden er avslått")
success_url = reverse_lazy("inventory:loans")

def get_success_url(self):
Expand All @@ -114,12 +111,12 @@ def get(self, request, *args, **kwargs):
return self.post(request, *args, **kwargs)


class ItemLoanReturnedView(PermissionRequiredMixin, DeleteView):
class ItemLoanReturnedView(BaseDetailView, PermissionRequiredMixin, DeletionMixin):
"""Endpoint for returning loans (deletes them)"""

model = ItemLoan
permission_required = "inventory.delete_itemloan"
success_message = "Lånesøknaden er lukket"
success_message = _("Lånesøknaden er lukket")
success_url = reverse_lazy("inventory:loans")

def get_success_url(self):
Expand Down
20 changes: 8 additions & 12 deletions news/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-03 19:21+0200\n"
"POT-Creation-Date: 2024-04-11 00:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -259,31 +259,31 @@ msgstr "Done"
msgid "Lagre og publiser arrangement"
msgstr "Save and publish event"

#: news/templates/news/edit_event.html:269
#: news/templates/news/edit_event.html:270
msgid "Kunne ikke hente flere resultater"
msgstr "The results could not be loaded"

#: news/templates/news/edit_event.html:270
#: news/templates/news/edit_event.html:271
msgid "Vennligst skriv inn flere tegn"
msgstr "Please add more characters"

#: news/templates/news/edit_event.html:271
#: news/templates/news/edit_event.html:272
msgid "Vennligst skriv inn færre tegn"
msgstr "Please remove characters"

#: news/templates/news/edit_event.html:272
#: news/templates/news/edit_event.html:273
msgid "Laster flere resultater"
msgstr "Loading more results"

#: news/templates/news/edit_event.html:273
#: news/templates/news/edit_event.html:274
msgid "Du kan ikke velge flere"
msgstr "You cannot choose more"

#: news/templates/news/edit_event.html:274
#: news/templates/news/edit_event.html:275
msgid "Ingen resultater"
msgstr "No results found"

#: news/templates/news/edit_event.html:275
#: news/templates/news/edit_event.html:276
msgid "Fjern alle"
msgstr "Remove all"

Expand All @@ -302,7 +302,6 @@ msgid ""
msgstr ""
"This event is open to all students regardless of Hackerspace membership"

#: news/templates/news/event.html:49
#: news/templates/news/event.html:49
msgid "Fra"
msgstr "From"
Expand Down Expand Up @@ -529,6 +528,3 @@ msgstr "Attendance Not Registered"
#: news/templates/news/skills_form.html:87
msgid "Save"
msgstr "Save"

#~ msgid "Arrangementansvarlig"
#~ msgstr "Event organizer"
16 changes: 8 additions & 8 deletions news/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-03 19:21+0200\n"
"POT-Creation-Date: 2024-04-11 00:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -261,31 +261,31 @@ msgstr ""
msgid "Lagre og publiser arrangement"
msgstr ""

#: news/templates/news/edit_event.html:269
#: news/templates/news/edit_event.html:270
msgid "Kunne ikke hente flere resultater"
msgstr ""

#: news/templates/news/edit_event.html:270
#: news/templates/news/edit_event.html:271
msgid "Vennligst skriv inn flere tegn"
msgstr ""

#: news/templates/news/edit_event.html:271
#: news/templates/news/edit_event.html:272
msgid "Vennligst skriv inn færre tegn"
msgstr ""

#: news/templates/news/edit_event.html:272
#: news/templates/news/edit_event.html:273
msgid "Laster flere resultater"
msgstr ""

#: news/templates/news/edit_event.html:273
#: news/templates/news/edit_event.html:274
msgid "Du kan ikke velge flere"
msgstr ""

#: news/templates/news/edit_event.html:274
#: news/templates/news/edit_event.html:275
msgid "Ingen resultater"
msgstr ""

#: news/templates/news/edit_event.html:275
#: news/templates/news/edit_event.html:276
msgid "Fjern alle"
msgstr ""

Expand Down

0 comments on commit e6f771f

Please sign in to comment.