mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
datetime.today() => date.today()
This commit is contained in:
parent
a43abee00b
commit
d962763987
@ -2,7 +2,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import io
|
import io
|
||||||
from datetime import datetime, timedelta
|
from datetime import timedelta, date
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -151,7 +151,7 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
|||||||
history_table.paginate(per_page=20, page=self.request.GET.get("transaction-page", 1))
|
history_table.paginate(per_page=20, page=self.request.GET.get("transaction-page", 1))
|
||||||
context['history_list'] = history_table
|
context['history_list'] = history_table
|
||||||
|
|
||||||
club_list = Membership.objects.filter(user=user, date_end__gte=datetime.today())\
|
club_list = Membership.objects.filter(user=user, date_end__gte=date.today())\
|
||||||
.filter(PermissionBackend.filter_queryset(self.request.user, Membership, "view"))
|
.filter(PermissionBackend.filter_queryset(self.request.user, Membership, "view"))
|
||||||
membership_table = MembershipTable(data=club_list, prefix='membership-')
|
membership_table = MembershipTable(data=club_list, prefix='membership-')
|
||||||
membership_table.paginate(per_page=10, page=self.request.GET.get("membership-page", 1))
|
membership_table.paginate(per_page=10, page=self.request.GET.get("membership-page", 1))
|
||||||
@ -374,7 +374,7 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
|||||||
context['history_list'] = history_table
|
context['history_list'] = history_table
|
||||||
club_member = Membership.objects.filter(
|
club_member = Membership.objects.filter(
|
||||||
club=club,
|
club=club,
|
||||||
date_end__gte=datetime.today(),
|
date_end__gte=date.today(),
|
||||||
).filter(PermissionBackend.filter_queryset(self.request.user, Membership, "view"))
|
).filter(PermissionBackend.filter_queryset(self.request.user, Membership, "view"))
|
||||||
|
|
||||||
membership_table = MembershipTable(data=club_member, prefix="membership-")
|
membership_table = MembershipTable(data=club_member, prefix="membership-")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
from datetime import datetime
|
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
@ -55,7 +56,7 @@ class Invoice(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
date = models.DateField(
|
date = models.DateField(
|
||||||
default=datetime.today,
|
default=date.today,
|
||||||
verbose_name=_("Date"),
|
verbose_name=_("Date"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -326,7 +327,7 @@ class SogeCredit(models.Model):
|
|||||||
for transaction in self.transactions.all():
|
for transaction in self.transactions.all():
|
||||||
transaction.valid = True
|
transaction.valid = True
|
||||||
transaction._force_save = True
|
transaction._force_save = True
|
||||||
transaction.created_at = datetime.now()
|
transaction.created_at = timezone.now()
|
||||||
transaction.save()
|
transaction.save()
|
||||||
|
|
||||||
def delete(self, **kwargs):
|
def delete(self, **kwargs):
|
||||||
@ -345,7 +346,7 @@ class SogeCredit(models.Model):
|
|||||||
for transaction in self.transactions.all():
|
for transaction in self.transactions.all():
|
||||||
transaction._force_save = True
|
transaction._force_save = True
|
||||||
transaction.valid = True
|
transaction.valid = True
|
||||||
transaction.created_at = datetime.now()
|
transaction.created_at = timezone.now()
|
||||||
transaction.save()
|
transaction.save()
|
||||||
super().delete(**kwargs)
|
super().delete(**kwargs)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime, date, timedelta
|
from datetime import date, timedelta
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
@ -119,7 +119,7 @@ class WEIDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
|||||||
|
|
||||||
club_member = WEIMembership.objects.filter(
|
club_member = WEIMembership.objects.filter(
|
||||||
club=club,
|
club=club,
|
||||||
date_end__gte=datetime.today(),
|
date_end__gte=date.today(),
|
||||||
).filter(PermissionBackend.filter_queryset(self.request.user, WEIMembership, "view"))
|
).filter(PermissionBackend.filter_queryset(self.request.user, WEIMembership, "view"))
|
||||||
membership_table = WEIMembershipTable(data=club_member, prefix="membership-")
|
membership_table = WEIMembershipTable(data=club_member, prefix="membership-")
|
||||||
membership_table.paginate(per_page=20, page=self.request.GET.get('membership-page', 1))
|
membership_table.paginate(per_page=20, page=self.request.GET.get('membership-page', 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user