|
|
|
|
@ -11,6 +11,7 @@ from django.shortcuts import get_object_or_404 |
|
|
|
|
from django.http import Http404 |
|
|
|
|
from django.utils import translation |
|
|
|
|
#models |
|
|
|
|
from accounts.models import User |
|
|
|
|
from models import Exposition |
|
|
|
|
from service.views import order_forms |
|
|
|
|
from service.models import Service |
|
|
|
|
@ -408,11 +409,11 @@ def add_note(request, slug): |
|
|
|
|
|
|
|
|
|
ct = ContentType.objects.get_for_model(e) |
|
|
|
|
object_id = e.id |
|
|
|
|
user = request.user |
|
|
|
|
if Note.objects.filter(user__id=user.id, content_type=ct, object_id=object_id).exists(): |
|
|
|
|
Note.objects.filter(user__id=user.id, content_type=ct, object_id=object_id).update(text=text) |
|
|
|
|
user = User.objects.get(id=request.user.id) |
|
|
|
|
if Note.objects.filter(user=user, content_type=ct, object_id=object_id).exists(): |
|
|
|
|
Note.objects.filter(user=user, content_type=ct, object_id=object_id).update(text=text) |
|
|
|
|
else: |
|
|
|
|
Note.objects.create(content_type=ct, object_id=object_id, user=user.id, text=text) |
|
|
|
|
Note.objects.create(content_type=ct, object_id=object_id, user=user, text=text) |
|
|
|
|
|
|
|
|
|
user.calendar.expositions.add(e) |
|
|
|
|
|
|
|
|
|
@ -420,4 +421,4 @@ def add_note(request, slug): |
|
|
|
|
args['success'] = True |
|
|
|
|
args['text'] = text |
|
|
|
|
|
|
|
|
|
return HttpResponse(json.dumps(args), content_type='application/json') |
|
|
|
|
return HttpResponse(json.dumps(args), content_type='application/json') |
|
|
|
|
|