Skip to content

Commit

Permalink
Updated naming of udlejning
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersSeverinsen committed Apr 4, 2024
1 parent dbf653b commit 866a61e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions fredagscafeen/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@
(
"KARET_PASSWORD",
"Hængelås-kodeord til karet",
"Dig selv",
None,
"https://fredagscafeen.dk",
),
(
"KOELESKABE_PASSWORD",
"Hængelås-kodeord til køleskabene i Nygaardkælderen",
"Dig selv",
None,
"https://fredagscafeen.dk",
),
]
Expand Down
14 changes: 7 additions & 7 deletions udlejning/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

from fredagscafeen.email import send_template_email
from udlejning.models import (
Udlejning,
UdlejningForegoing,
UdlejningApplication,
UdlejningGrill,
UdlejningProjector,
UdlejningSpeakers,
UdlejningSpeaker,
)


Expand All @@ -37,8 +37,8 @@ def queryset(self, request, queryset):


# Remember to cut down to 2 classes
@admin.register(Udlejning)
class UdlejningAdmin(admin.ModelAdmin):
@admin.register(UdlejningForegoing)
class UdlejningForegoingAdmin(admin.ModelAdmin):
ordering = ("-dateFrom",)
list_display = (
"dateFrom",
Expand Down Expand Up @@ -139,7 +139,7 @@ def _send_accept_email(self, u):
def accept(self, request, obj):
pk = obj.accept()
obj.delete()
self._send_accept_email(Udlejning.objects.get(id=pk))
self._send_accept_email(UdlejningForegoing.objects.get(id=pk))
return HttpResponseRedirect(
reverse("admin:udlejning_udlejning_change", args=(pk,))
)
Expand Down Expand Up @@ -171,7 +171,7 @@ class UdlejningProjectorAdmin(admin.ModelAdmin):
list_display = ("dateFrom", "whoReserved")


@admin.register(UdlejningSpeakers)
class UdlejningSpeakersAdmin(admin.ModelAdmin):
@admin.register(UdlejningSpeaker)
class UdlejningSpeakerAdmin(admin.ModelAdmin):
ordering = ("-dateFrom",)
list_display = ("dateFrom", "whoReserved")
6 changes: 3 additions & 3 deletions udlejning/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __str__(self):
return f"{self.dateFrom} {self.whoReserved}"


class Udlejning(UdlejningCommon):
class UdlejningForegoing(UdlejningCommon):
ASSOCIATION_CHOICES = (
("internal", "Intern"),
("external", "Ekstern"),
Expand Down Expand Up @@ -130,7 +130,7 @@ class Meta:
def accept(self):
common_fields = super()._meta.get_fields()
value_dict = {f.name: getattr(self, f.name) for f in common_fields}
u = Udlejning.objects.create(**value_dict)
u = UdlejningForegoing.objects.create(**value_dict)
return u.pk


Expand Down Expand Up @@ -158,7 +158,7 @@ class Meta:
ordering = ("dateFrom",)


class UdlejningSpeakers(models.Model):
class UdlejningSpeaker(models.Model):
dateFrom = models.DateTimeField()
dateTo = models.DateTimeField()
whoReserved = models.TextField(max_length=140, blank=True)
Expand Down
8 changes: 4 additions & 4 deletions udlejning/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

from .forms import UdlejningApplicationForm
from .models import (
Udlejning,
UdlejningForegoing,
UdlejningApplication,
UdlejningGrill,
UdlejningProjector,
UdlejningSpeakers,
UdlejningSpeaker,
)


Expand All @@ -22,7 +22,7 @@ class Udlejninger(CreateView):

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["udlejninger"] = Udlejning.objects.filter(
context["udlejninger"] = UdlejningForegoing.objects.filter(
dateFrom__gte=timezone.now() - datetime.timedelta(days=30)
)
return context
Expand Down Expand Up @@ -61,6 +61,6 @@ class UdlejningerProjector(ListView):
class UdlejningerSpeakers(ListView):
template_name = "udlejningSpeakers.html"
allow_empty = True
queryset = UdlejningSpeakers.objects.filter(
queryset = UdlejningSpeaker.objects.filter(
dateFrom__gte=timezone.now() - datetime.timedelta(days=30)
)

0 comments on commit 866a61e

Please sign in to comment.