|
|
@@ -1,10 +1,13 @@
|
|
|
from datetime import datetime
|
|
|
+import json
|
|
|
|
|
|
from django.contrib.auth import logout, login, update_session_auth_hash
|
|
|
from django.contrib.auth.decorators import login_required
|
|
|
from django.contrib.auth.forms import PasswordChangeForm
|
|
|
from django.contrib.auth.models import User
|
|
|
+from django.core import serializers
|
|
|
from django.core.paginator import Paginator
|
|
|
+from django.http.response import HttpResponse
|
|
|
from django.shortcuts import render, get_object_or_404, redirect
|
|
|
|
|
|
from main.forms import StoryForm, EpicForm, RegisterForm, ProfileForm, \
|
|
|
@@ -244,7 +247,7 @@ def report_projects(request):
|
|
|
return render(request, 'reports/report_projects.html', {'epics': epics})
|
|
|
|
|
|
@login_required
|
|
|
-def comment(request, obj_uuid):
|
|
|
+def comment_post(request, obj_uuid):
|
|
|
comment = Comment()
|
|
|
comment.obj_uuid = obj_uuid
|
|
|
comment.author = get_object_or_404(User, username=request.user)
|
|
|
@@ -252,6 +255,28 @@ def comment(request, obj_uuid):
|
|
|
comment.save()
|
|
|
return redirect(request.META['HTTP_REFERER'])
|
|
|
|
|
|
+# @login_required
|
|
|
+# def comment_post(request, obj_uuid):
|
|
|
+# data = json.loads(request.body.decode('utf-8'))
|
|
|
+# comment = Comment()
|
|
|
+# comment.obj_uuid = obj_uuid
|
|
|
+# comment.author = get_object_or_404(User, username=request.user)
|
|
|
+# comment.content = data["content"]
|
|
|
+# comment.save()
|
|
|
+# return HttpResponse(comment.to_json(),content_type="application/json")
|
|
|
+#
|
|
|
+# def comment_edit(request, comment_id):
|
|
|
+# data = json.loads(request.body.decode('utf-8'))
|
|
|
+# comment = get_object_or_404(Comment, id=comment_id)
|
|
|
+# comment.content= data["content"]
|
|
|
+# comment.save()
|
|
|
+# return HttpResponse(comment.to_json(),content_type="application/json")
|
|
|
+#
|
|
|
+# def comment_del(_, comment_id):
|
|
|
+# comment = get_object_or_404(Comment, id=comment_id)
|
|
|
+# comment.delete()
|
|
|
+# return HttpResponse("{}",content_type="application/json")
|
|
|
+
|
|
|
@login_required
|
|
|
def search(request):
|
|
|
qstr = request.GET["q"]
|