verbose_name = _('plan')
verbose_name_plural = _('plans')
- def __unicode__(self):
+ def __str__(self):
return "%s %s" % (self.min_amount, self.get_interval_display())
class Meta:
verbose_name = _('schedule')
verbose_name_plural = _('schedules')
- def __unicode__(self):
+ def __str__(self):
return self.key
def save(self, *args, **kwargs):
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()
verbose_name = _('payment')
verbose_name_plural = _('payments')
- def __unicode__(self):
+ def __str__(self):
return "%s %s" % (self.schedule, self.payed_at)
verbose_name = _('membership')
verbose_name_plural = _('memberships')
- def __unicode__(self):
- return u'tow. ' + unicode(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):
verbose_name_plural = _('reminder emails')
ordering = ['days_before']
- def __unicode__(self):
+ def __str__(self):
if self.days_before >= 0:
return ungettext('a day before expiration', '%d days before expiration', n=self.days_before)
else: