use django.utils timezone rather than datetime

This commit is contained in:
Stephan Telling 2018-08-01 12:25:43 +02:00
parent e04038e4a0
commit d03af1c11e
No known key found for this signature in database
GPG key ID: E2A0AE38ABC88337

View file

@ -1,12 +1,12 @@
import logging
from itertools import chain
from datetime import datetime
from django.views.generic import TemplateView, ListView
from django.views.generic.edit import UpdateView
from django.shortcuts import redirect
from django.urls import reverse
from django.contrib import messages
from django.utils import timezone
from shop.models import OrderProductRelation
from tickets.models import ShopTicket, SponsorTicket, DiscountTicket
@ -128,7 +128,7 @@ class MerchandiseOrdersView(BackofficeViewMixin, ListView):
template_name = "orders_merchandise.html"
def get_queryset(self, **kwargs):
camp_prefix = 'BornHack {}'.format(datetime.now().strftime('%Y'))
camp_prefix = 'BornHack {}'.format(timezone.now().year)
return OrderProductRelation.objects.filter(
handed_out=False,
@ -145,7 +145,7 @@ class MerchandiseToOrderView(BackofficeViewMixin, TemplateView):
template_name = "merchandise_to_order.html"
def get_context_data(self, **kwargs):
camp_prefix = 'BornHack {}'.format(datetime.now().strftime('%Y'))
camp_prefix = 'BornHack {}'.format(timezone.now().year)
order_relations = OrderProductRelation.objects.filter(
handed_out=False,