def activity_stream(request, all): if not request.user.has_perm('activitystream.view_everything'): return PermissionDenied(request) NUM_OF_ACTIVITIES = 20 if request.method == 'POST' and request.user.has_perm('activitystream.add_activity'): form = ActivityMessageForm(request.POST) if form.is_valid(): message = form.cleaned_data['message'] activity = Activity(message_type = Activity.MSG_USER, message = message) activity.save() else: form = ActivityMessageForm() if all: activities = Activity.objects.all() else: activities = Activity.objects.all()[:NUM_OF_ACTIVITIES] return render(request,'activity_stream.html',{'activities':activities, 'form':form, 'all':all})
def createActivity(self, action): activity = Activity( message_type = Activity.MSG_GESTOR_ACTION_NOTE, action_type = action, object_id = self.id, message = self.actionitem.title ) activity.save()
def createActivity(self, action): activity = Activity( message_type = Activity.MSG_GESTOR_PROJECT, action_type = action, object_id = self.id, message = self.name ) activity.save()
def create_activity(self, actor, verb, post=None, comment=None): if verb == 'PST': activity = Activity(actor=actor, verb='PST', comment=None, post=post) activity.save() elif verb == 'CMT': activity = Activity(actor=actor, verb='CMT', comment=comment, post=post) activity.save() elif verb == 'UVT': activity = Activity(actor=actor, verb='UVT', comment=None, post=post) activity.save()