fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes #3934: Error on OAI-PMH list request.
[wolnelektury.git]
/
src
/
club
/
models.py
diff --git
a/src/club/models.py
b/src/club/models.py
index
1777174
..
ede1a8d
100644
(file)
--- a/
src/club/models.py
+++ b/
src/club/models.py
@@
-88,7
+88,6
@@
class Schedule(models.Model):
def get_payment_method(self):
return method_by_slug[self.method]
def get_payment_method(self):
return method_by_slug[self.method]
-
def is_expired(self):
return self.expires_at is not None and self.expires_at < now()
def is_expired(self):
return self.expires_at is not None and self.expires_at < now()
@@
-125,6
+124,16
@@
class Membership(models.Model):
def __str__(self):
return u'tow. ' + str(self.user)
def __str__(self):
return u'tow. ' + str(self.user)
+ @classmethod
+ def is_active_for(self, user):
+ if user.is_anonymous:
+ return False
+ return Schedule.objects.filter(
+ models.Q(expires_at=None) | models.Q(expires_at__lt=now()),
+ membership__user=user,
+ is_active=True,
+ ).exists()
+
class ReminderEmail(models.Model):
days_before = models.SmallIntegerField(_('days before'))
class ReminderEmail(models.Model):
days_before = models.SmallIntegerField(_('days before'))