def post(self, request, *args, **kwargs): reply = Reply(title=request.POST['title'], content=request.POST['content']) project = Project.objects.get(slug=self.kwargs['project_slug']) reply.author=ProjectActor.objects.get(user=self.request.user, project=project) reply.subject=Subject.objects.get(id=self.kwargs['subject_id']) reply.save() if "thirdparty.notification" in settings.INSTALLED_APPS: from thirdparty.notification import models as notification to_users = [] for actor in project.actors.all(): to_users.append(actor.user) notification.queue(to_users, "new_reply_posted", {'reply': reply}) return HttpResponseRedirect(reply.subject.get_absolute_url())
def post(self, request, *args, **kwargs): tags_str = self.request.POST['tags'] tags_list = tags_str.split(',') for t in tags_list: self.tags.append(t) subject = Subject(name=request.POST['name'], content=request.POST['content']) project = Project.objects.get(slug=self.kwargs['project_slug']) subject.author=ProjectActor.objects.get(user=self.request.user, project=project) subject.iteration=Iteration.objects.get(slug=self.kwargs['iteration_slug']) subject.state=State.objects.get(name='Open') subject.save() for tag in self.tags: if tag != '' and tag != ' ' and tag != ' ': t, created = Tag.objects.get_or_create(name=tag, defaults={'content_object': subject}) if "thirdparty.notification" in settings.INSTALLED_APPS: from thirdparty.notification import models as notification to_users = [] for actor in project.actors.all(): to_users.append(actor.user) notification.queue(to_users, "new_subject_posted", {'subject': subject}) return HttpResponseRedirect(subject.get_absolute_url())