コード例 #1
0
def handle_sub_canceled(sender, instance, **kwargs):
    instance.cancellation_date = instance.cancellation_date or timezone.now(
    ).date()
    for extra in instance.extra_subscription_set.all():
        cancel_extra_sub(extra)
    for part in instance.parts.filter(q_activated()).all():
        part.cancel()
    for part in instance.parts.filter(~q_activated()).all():
        part.delete()
コード例 #2
0
 def not_started_subscriptions():
     return Subscription.objects.filter(~q_activated()).order_by(
         'start_date')
コード例 #3
0
 def all_active_extrasubscritions():
     return ExtraSubscription.objects.filter(q_activated()
                                             & ~q_deactivated())
コード例 #4
0
 def waiting_extra_subs():
     return ExtraSubscription.objects.filter(~q_activated())
コード例 #5
0
 def canceled_extra_subs():
     return ExtraSubscription.objects.filter(q_activated() & q_cancelled()
                                             & ~q_deactivated())
コード例 #6
0
 def active_parts(self):
     return self.parts.filter(q_activated() & ~q_deactivated())
コード例 #7
0
 def extra_subscriptions(self):
     return self.extra_subscription_set.filter(q_activated()
                                               & ~q_deactivated())
コード例 #8
0
 def types_changed(self):
     return self.parts.filter(~q_activated()
                              | (q_cancelled() & ~q_deactivated())).count()
コード例 #9
0
 def active_subscritions_by_depot(depot):
     return Subscription.objects.filter(depot=depot).filter(q_activated())
コード例 #10
0
 def active_subscriptions(self):
     return self.subscription_set.filter(q_activated()
                                         & ~q_deactivated()).order_by(
                                             'primary_member__first_name')
コード例 #11
0
 def get_waiting_for_subscription(subscription):
     return SubscriptionPart.objects.filter(
         subscription=subscription).filter(~q_activated())