mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-13 13:29:23 +00:00
Mise à jour de février (#581)
Co-authored-by: Thomas Girod <thgirod@hotmail.com> Co-authored-by: Julien Constant <julienconstant190@gmail.com> Co-authored-by: Skia <skia@hya.sk>
This commit is contained in:
@ -24,7 +24,6 @@
|
||||
|
||||
from datetime import date, timedelta
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
@ -101,8 +100,8 @@ class Subscription(models.Model):
|
||||
super(Subscription, self).save()
|
||||
from counter.models import Customer
|
||||
|
||||
if not Customer.objects.filter(user=self.member).exists():
|
||||
Customer.new_for_user(self.member).save()
|
||||
_, created = Customer.get_or_create(self.member)
|
||||
if created:
|
||||
form = PasswordResetForm({"email": self.member.email})
|
||||
if form.is_valid():
|
||||
form.save(
|
||||
@ -166,7 +165,4 @@ class Subscription(models.Model):
|
||||
return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user.is_root
|
||||
|
||||
def is_valid_now(self):
|
||||
return (
|
||||
self.subscription_start <= date.today()
|
||||
and date.today() <= self.subscription_end
|
||||
)
|
||||
return self.subscription_start <= date.today() <= self.subscription_end
|
||||
|
@ -22,12 +22,12 @@
|
||||
#
|
||||
#
|
||||
|
||||
from django.urls import re_path
|
||||
from django.urls import path
|
||||
|
||||
from subscription.views import *
|
||||
|
||||
urlpatterns = [
|
||||
# Subscription views
|
||||
re_path(r"^$", NewSubscription.as_view(), name="subscription"),
|
||||
re_path(r"stats", SubscriptionsStatsView.as_view(), name="stats"),
|
||||
path("", NewSubscription.as_view(), name="subscription"),
|
||||
path("stats/", SubscriptionsStatsView.as_view(), name="stats"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user