コード例 #1
0
ファイル: views.py プロジェクト: jeKnowledge/gestor
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})
コード例 #2
0
ファイル: models.py プロジェクト: jeKnowledge/gestor
	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()
コード例 #3
0
ファイル: models.py プロジェクト: jeKnowledge/gestor
	def createActivity(self, action):
		activity = Activity( message_type = Activity.MSG_GESTOR_PROJECT, 
							 action_type = action, 
							 object_id = self.id,
							 message = self.name )
		activity.save()
コード例 #4
0
ファイル: feeds.py プロジェクト: rajeevrmenon97/activityfeed
 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()