示例#1
0
 def get_moderation(self, akey, user_profile, data, node, **kwargs):
     
     new_moderation = Moderation()
     
     new_moderation.akey = akey
     new_moderation.action = kwargs['action']
     new_moderation.locale = get_language()
     new_moderation.path = node.get_url()
     
     new_moderation.related = node
     
     new_moderation.username = user_profile.username
     new_moderation.email = user_profile.email
     new_moderation.validated = user_profile.validated
     
     if kwargs['action'] == 'comment':
         new_moderation.subject = 'Nouveau commentaire'
     
     elif kwargs['action'] == 'review':
         new_moderation.subject = 'Nouvel avis'
     
     elif kwargs['action'] == 'discuss':
         new_moderation.subject = 'Nouveau message'
     
     
     
     return new_moderation
示例#2
0
文件: ui.py 项目: encolpe/apetizer
 def create_proposal(self, request, user_profile, input_data, template_args, **kwargs):
     
     # create a moderation with the request 
     # action and data and a proposal status
     mod = Moderation()
     
     mod.akey = user_profile.akey
     mod.email = user_profile.email
     mod.username = user_profile.username
     mod.locale = get_language()
     
     mod.subject = 'Wants to change'
     mod.message = 'Wants to change'
     
     mod.action = kwargs['action']
     mod.data = json.dumps(input_data)
     
     mod.status = 'proposed'
     
     mod.path = kwargs['node'].path
     
     mod.related_id = kwargs['node'].id
     
     mod.visible = False
     mod.completed_date = now()
     mod.save()
     
     messages.warning(request, 'Your proposal have been posted !')
     
     return HttpResponseRedirect(kwargs['node'].get_url()+'view/')