mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Add notification
This commit is contained in:
@ -15,7 +15,7 @@ import datetime
|
||||
|
||||
from club.models import Club
|
||||
from accounting.models import CurrencyField
|
||||
from core.models import Group, User
|
||||
from core.models import Group, User, Notification
|
||||
from subscription.models import Subscriber, Subscription
|
||||
from subscription.views import get_subscriber
|
||||
|
||||
@ -270,6 +270,12 @@ class Refilling(models.Model):
|
||||
self.customer.amount += self.amount
|
||||
self.customer.save()
|
||||
self.is_validated = True
|
||||
Notification(
|
||||
user=self.customer.user,
|
||||
url=reverse('core:user_account_detail',
|
||||
kwargs={'user_id': self.customer.user.id, 'year': self.date.year, 'month': self.date.month}),
|
||||
text=_("You just refilled of %(amount)s €") % {'amount': self.amount}
|
||||
).save()
|
||||
super(Refilling, self).save(*args, **kwargs)
|
||||
|
||||
class Selling(models.Model):
|
||||
@ -377,6 +383,13 @@ class Selling(models.Model):
|
||||
if self.product.eticket:
|
||||
self.send_mail_customer()
|
||||
except: pass
|
||||
Notification(
|
||||
user=self.customer.user,
|
||||
url=reverse('core:user_account_detail',
|
||||
kwargs={'user_id': self.customer.user.id, 'year': self.date.year, 'month': self.date.month}),
|
||||
text=_("You just bought %(quantity)d %(product_name)s") % {'quantity': self.quantity, 'product_name': self.label}
|
||||
).save()
|
||||
|
||||
super(Selling, self).save(*args, **kwargs)
|
||||
|
||||
class Permanency(models.Model):
|
||||
|
Reference in New Issue
Block a user