示例#1
0
 def __init__(self, data=None, activity=None, user=None):
     self.user = user
     if activity:
         initial = {
                 'is_observed': Watching.is_subscribed(activity, user),
                 'activity': activity.id,
         }
     else:
         initial = None
     super(SubscribeForm, self).__init__(data, initial=initial)
示例#2
0
 def save(self):
     activity = self.cleaned_data['activity']
     Watching.subscribe(activity, self.user, self.cleaned_data['is_observed'])