|
|
|
|
@ -409,8 +409,8 @@ def add_note(request, slug): |
|
|
|
|
ct = ContentType.objects.get_for_model(e) |
|
|
|
|
object_id = e.id |
|
|
|
|
user = request.user |
|
|
|
|
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) |
|
|
|
|
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) |
|
|
|
|
else: |
|
|
|
|
Note.objects.create(content_type=ct, object_id=object_id, user=user, text=text) |
|
|
|
|
|
|
|
|
|
|