File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -105,20 +105,7 @@ def __user_get_active_subscription(user):
105
105
return None
106
106
auth .models .User .add_to_class ('get_active_subscription' ,__user_get_active_subscription )
107
107
108
- class UserSubscriptionManager (models .Manager ):
109
- def unsubscribe_expired (self ):
110
- """Unsubscribes all users whose subscription has expired.
111
-
112
- Loops through all UserSubscription objects with `expires' field
113
- earlier than datetime.date.today() and forces correct group
114
- membership.
115
-
116
- Run this on a cronjob, every X minutes/hours/days.
117
- """
118
- for us in self .objects .get (expires__lt = datetime .date .today ()):
119
- us .fix ()
120
-
121
- class ActiveUSManager (UserSubscriptionManager ):
108
+ class ActiveUSManager (models .Manager ):
122
109
"""Custom Manager for UserSubscription that returns only live US objects."""
123
110
def get_query_set (self ):
124
111
return super (ActiveUSManager , self ).get_query_set ().filter (active = True )
@@ -284,3 +271,15 @@ def __unicode__(self):
284
271
if self .expired ():
285
272
rv += u' (expired)'
286
273
return rv
274
+
275
+ def unsubscribe_expired ():
276
+ """Unsubscribes all users whose subscription has expired.
277
+
278
+ Loops through all UserSubscription objects with `expires' field
279
+ earlier than datetime.date.today() and forces correct group
280
+ membership.
281
+
282
+ Run this on a cronjob, every X minutes/hours/days.
283
+ """
284
+ for us in UserSubscription .objects .filter (expires__lt = datetime .date .today ()):
285
+ us .fix ()
You can’t perform that action at this time.
0 commit comments