Compare commits
3 Commits
caa7a15150
...
0ab362eb7c
Author | SHA1 | Date |
---|---|---|
Gregory Trullemans | 0ab362eb7c | |
Gregory Trullemans | a075a592a5 | |
Gregory Trullemans | 915ad96cf2 |
|
@ -6,6 +6,7 @@ from django.db.models import Q, Min, Avg, Max, Sum
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
|
|
||||||
|
@ -545,7 +546,10 @@ def chrono_create_or_update(request, chrono_id=None, gymnast_id=None):
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=0):
|
functionality = ContentType.objects.get(model="chrono")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouveau chrono",
|
f"{gymnast} : Nouveau chrono",
|
||||||
f"Un nouveau chrono enregistré pour {gymnast}",
|
f"Un nouveau chrono enregistré pour {gymnast}",
|
||||||
|
@ -624,7 +628,10 @@ def learnedskill_create_or_update(request, gymnast_id=None):
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=2):
|
functionality = ContentType.objects.get(model="learnedskill")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouveau skill appris",
|
f"{gymnast} : Nouveau skill appris",
|
||||||
f"Un nouveau skill a été appris par {gymnast}",
|
f"Un nouveau skill a été appris par {gymnast}",
|
||||||
|
@ -677,7 +684,10 @@ def score_create_or_update(request, score_id=None, gymnast_id=None):
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=4):
|
functionality = ContentType.objects.get(model="point")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouveau score enregistré",
|
f"{gymnast} : Nouveau score enregistré",
|
||||||
f"Un nouveau score a été enregistré pour {gymnast}",
|
f"Un nouveau score a été enregistré pour {gymnast}",
|
||||||
|
@ -797,7 +807,10 @@ def accident_create_or_update(request, accident_id=None, gymnast_id=None):
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=1):
|
functionality = ContentType.objects.get(model="accident")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouvel accident enregistré",
|
f"{gymnast} : Nouvel accident enregistré",
|
||||||
f"Un nouvel accident enregistré pour {gymnast}",
|
f"Un nouvel accident enregistré pour {gymnast}",
|
||||||
|
@ -879,7 +892,10 @@ def mindstate_create_or_update(
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=5):
|
functionality = ContentType.objects.get(model="mindstate")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouvel état d'esprit enregistré",
|
f"{gymnast} : Nouvel état d'esprit enregistré",
|
||||||
f"Un nouvel état d'esprit enregistré pour {gymnast}",
|
f"Un nouvel état d'esprit enregistré pour {gymnast}",
|
||||||
|
@ -961,7 +977,10 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=8):
|
functionality = ContentType.objects.get(model="heightweight")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouveau poids/taille enregistré",
|
f"{gymnast} : Nouveau poids/taille enregistré",
|
||||||
f"Un nouveau poids/taille enregistré pour {gymnast}",
|
f"Un nouveau poids/taille enregistré pour {gymnast}",
|
||||||
|
@ -1052,7 +1071,7 @@ def increment_routinedone(request):
|
||||||
@login_required
|
@login_required
|
||||||
@require_http_methods(["GET", "POST"])
|
@require_http_methods(["GET", "POST"])
|
||||||
def routinedone_create_or_update(request, routinedone_id=None, gymnast_id=None):
|
def routinedone_create_or_update(request, routinedone_id=None, gymnast_id=None):
|
||||||
"""Création ou modification d'un chrono"""
|
"""Création ou modification d'un nombre de série tentée."""
|
||||||
|
|
||||||
if routinedone_id:
|
if routinedone_id:
|
||||||
routinedone = get_object_or_404(NumberOfRoutineDone, pk=routinedone_id)
|
routinedone = get_object_or_404(NumberOfRoutineDone, pk=routinedone_id)
|
||||||
|
@ -1089,7 +1108,10 @@ def routinedone_create_or_update(request, routinedone_id=None, gymnast_id=None):
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=7):
|
functionality = ContentType.objects.get(model="numberofroutinedone")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouvelle série comptabilisée",
|
f"{gymnast} : Nouvelle série comptabilisée",
|
||||||
f"Nouvelle série comptabilisée pour {gymnast}",
|
f"Nouvelle série comptabilisée pour {gymnast}",
|
||||||
|
@ -1158,7 +1180,10 @@ def plan_create_or_update(request, plan_id=None, gymnast_id=None, skill_id=None)
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=7):
|
functionality = ContentType.objects.get(model="plan")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouvelle série comptabilisée",
|
f"{gymnast} : Nouvelle série comptabilisée",
|
||||||
f"Nouvelle série comptabilisée pour {gymnast}",
|
f"Nouvelle série comptabilisée pour {gymnast}",
|
||||||
|
@ -1246,7 +1271,10 @@ def intensity_create_or_update(request, intensity_id=None, gymnast_id=None):
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=10):
|
functionality = ContentType.objects.get(model="intensity")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouvelle intensité",
|
f"{gymnast} : Nouvelle intensité",
|
||||||
f"Une nouvelle note vous a été envoyée pour {gymnast}",
|
f"Une nouvelle note vous a été envoyée pour {gymnast}",
|
||||||
|
@ -1313,7 +1341,10 @@ def season_information_create_or_update(
|
||||||
|
|
||||||
# notification
|
# notification
|
||||||
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
gymnast = Gymnast.objects.get(pk=form.cleaned_data["gymnast"].id)
|
||||||
for notification in gymnast.notifications.filter(functionality=11):
|
functionality = ContentType.objects.get(model="seasoninformation")
|
||||||
|
for notification in gymnast.notifications.filter(
|
||||||
|
functionality=functionality
|
||||||
|
):
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouvelle information de saison",
|
f"{gymnast} : Nouvelle information de saison",
|
||||||
f"Une nouvelle information de saison enregistrée pour {gymnast}",
|
f"Une nouvelle information de saison enregistrée pour {gymnast}",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import Profile # , Notification
|
from .models import Profile, Notification
|
||||||
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
|
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,15 +12,15 @@ class ProfileAdmin(admin.ModelAdmin):
|
||||||
admin.site.register(Profile, ProfileAdmin)
|
admin.site.register(Profile, ProfileAdmin)
|
||||||
|
|
||||||
|
|
||||||
# class NotificationAdmin(admin.ModelAdmin):
|
class NotificationAdmin(admin.ModelAdmin):
|
||||||
# model = Notification
|
model = Notification
|
||||||
# list_display = ("user", "gymnast", "functionality")
|
list_display = ("user", "gymnast", "functionality")
|
||||||
# autocomplete_fields = ("user", "gymnast")
|
autocomplete_fields = ("user", "gymnast")
|
||||||
# list_filter = (
|
list_filter = (
|
||||||
# ("user", RelatedDropdownFilter),
|
("user", RelatedDropdownFilter),
|
||||||
# ("gymnast", RelatedDropdownFilter),
|
("gymnast", RelatedDropdownFilter),
|
||||||
# ("functionality", RelatedDropdownFilter),
|
("functionality", RelatedDropdownFilter),
|
||||||
# )
|
)
|
||||||
|
|
||||||
|
|
||||||
# admin.site.register(Notification, NotificationAdmin)
|
admin.site.register(Notification, NotificationAdmin)
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
# Generated by Django 4.2 on 2023-04-27 11:54
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("people", "0008_alter_gymnast_orientation"),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
("contenttypes", "0002_remove_content_type_name"),
|
||||||
|
("profiles", "0001_initial"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Notification",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"functionality",
|
||||||
|
models.ForeignKey(
|
||||||
|
limit_choices_to={"app_label": "followup"},
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="contenttypes.contenttype",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"gymnast",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="notifications",
|
||||||
|
to="people.gymnast",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"user",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"unique_together": {("user", "gymnast", "functionality")},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -7,7 +7,7 @@ Les profils peuvent enregistrer les informations suivantes:
|
||||||
* si la barre de navigation doit être cachée ou non
|
* si la barre de navigation doit être cachée ou non
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from jarvis.people.models import Gymnast
|
from jarvis.people.models import Gymnast
|
||||||
|
@ -44,21 +44,21 @@ class Profile(models.Model):
|
||||||
return "%s %s" % (self.user.first_name, self.user.last_name)
|
return "%s %s" % (self.user.first_name, self.user.last_name)
|
||||||
|
|
||||||
|
|
||||||
# class Notification(models.Model):
|
class Notification(models.Model):
|
||||||
# """Classe permettant de définir quelles notification un utilisateur veut recevoir."""
|
"""Classe permettant de définir quelles notification un utilisateur veut recevoir."""
|
||||||
|
|
||||||
# class Meta:
|
class Meta:
|
||||||
# unique_together = ("user", "gymnast", "functionality")
|
unique_together = ("user", "gymnast", "functionality")
|
||||||
|
|
||||||
# user = models.ForeignKey(User, on_delete=models.CASCADE)
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
# gymnast = models.ForeignKey(
|
gymnast = models.ForeignKey(
|
||||||
# Gymnast, on_delete=models.CASCADE, related_name="notifications"
|
Gymnast, on_delete=models.CASCADE, related_name="notifications"
|
||||||
# )
|
)
|
||||||
# functionality = models.ForeignKey(
|
functionality = models.ForeignKey(
|
||||||
# ContentType,
|
ContentType,
|
||||||
# on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
# limit_choices_to={"app_label": "followup"},
|
limit_choices_to={"app_label": "followup"},
|
||||||
# )
|
)
|
||||||
|
|
||||||
# def __str__(self):
|
def __str__(self):
|
||||||
# return f"{self.user} will be notified for add/update {self.functionality} to {self.gymnast}"
|
return f"{self.user} will be notified for add/update {self.functionality} to {self.gymnast}"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% extends "listing.html" %}
|
{% extends "listing.html" %}
|
||||||
|
{% load get_item %}
|
||||||
|
|
||||||
{% block datacontent %}
|
{% block datacontent %}
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
@ -22,10 +23,10 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for functionality in functionality_list %}
|
{% for functionality in functionality_list %}
|
||||||
<div class="col-md-8 ml-3">
|
<div class="col-md-8 ml-3">
|
||||||
{{ functionality.1 }}
|
{{ functionality }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<input type="checkbox" name="checkbox" class="update_notification" data-gymnast="{{ gymnast.id }}" data-functionality="{{ functionality.0 }}" />
|
<input type="checkbox" name="checkbox" class="update_notification" data-gymnast="{{ gymnast.id }}" data-functionality="{{ functionality.id }}" {% if functionality.id in notification_dict|get_item:gymnast.id %}checked{% endif %} />
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
gymnast_id: $(this).data("gymnast"),
|
gymnast_id: $(this).data("gymnast"),
|
||||||
notification_id: $(this).data("functionality"),
|
functionality_id: $(this).data("functionality"),
|
||||||
csrfmiddlewaretoken: '{{ csrf_token }}'
|
csrfmiddlewaretoken: '{{ csrf_token }}'
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
@ -63,7 +64,7 @@
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
gymnast_id: $(this).data("gymnast"),
|
gymnast_id: $(this).data("gymnast"),
|
||||||
notification_id: $(this).data("functionality"),
|
functionality_id: $(this).data("functionality"),
|
||||||
csrfmiddlewaretoken: '{{ csrf_token }}'
|
csrfmiddlewaretoken: '{{ csrf_token }}'
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
|
@ -7,11 +7,11 @@ from . import views
|
||||||
|
|
||||||
profile_urlpatterns = [
|
profile_urlpatterns = [
|
||||||
path(r"edit/", views.profile_update, name="profile_update"),
|
path(r"edit/", views.profile_update, name="profile_update"),
|
||||||
# path(
|
path(
|
||||||
# r"notification_update/", views.notification_update, name="notification_update"
|
r"notification_update/", views.notification_update, name="notification_update"
|
||||||
# ),
|
),
|
||||||
# path(r"notification_add/", views.notification_add, name="notification_add"),
|
path(r"notification_add/", views.notification_add, name="notification_add"),
|
||||||
# path(
|
path(
|
||||||
# r"notification_remove/", views.notification_remove, name="notification_remove"
|
r"notification_remove/", views.notification_remove, name="notification_remove"
|
||||||
# ),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.http import HttpResponseRedirect, HttpResponse
|
from django.http import HttpResponseRedirect, HttpResponse
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.views.decorators.http import require_http_methods
|
from django.views.decorators.http import require_http_methods
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from .forms import ProfileForm
|
from .forms import ProfileForm
|
||||||
from .models import Profile # , Notification, FUNCTIONALITY_CHOICES
|
from .models import Profile, Notification
|
||||||
from jarvis.people.models import Gymnast
|
from jarvis.people.models import Gymnast
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,50 +45,61 @@ def profile_update(request):
|
||||||
return render(request, "update.html", context)
|
return render(request, "update.html", context)
|
||||||
|
|
||||||
|
|
||||||
# @login_required
|
@login_required
|
||||||
# @require_http_methods(["GET", "POST"])
|
@require_http_methods(["GET", "POST"])
|
||||||
# def notification_update(request):
|
def notification_update(request):
|
||||||
# gymnast_list = Gymnast.objects.filter(is_active=True)
|
gymnast_list = Gymnast.objects.filter(is_active=True)
|
||||||
|
functionality_list = ContentType.objects.filter(app_label="followup")
|
||||||
|
|
||||||
# context = {
|
notification_dict = {}
|
||||||
# "gymnast_list": gymnast_list,
|
for gymnast in gymnast_list:
|
||||||
# "functionality_list": FUNCTIONALITY_CHOICES,
|
query = gymnast.notifications.filter(user=request.user).values_list(
|
||||||
# }
|
"functionality", flat=True
|
||||||
# return render(request, "notification_update.html", context)
|
)
|
||||||
|
if query:
|
||||||
|
notification_dict[gymnast.id] = query
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"gymnast_list": gymnast_list,
|
||||||
|
"functionality_list": functionality_list,
|
||||||
|
"notification_dict": notification_dict,
|
||||||
|
}
|
||||||
|
return render(request, "notification_update.html", context)
|
||||||
|
|
||||||
|
|
||||||
# @require_http_methods(["POST"])
|
@require_http_methods(["POST"])
|
||||||
# def notification_add(request):
|
def notification_add(request):
|
||||||
# """
|
"""
|
||||||
# Ajoute une demande de notification
|
Ajoute une demande de notification
|
||||||
# """
|
"""
|
||||||
# gymnast_id = request.POST.get("gymnast_id", None)
|
gymnast_id = request.POST.get("gymnast_id", None)
|
||||||
# notification_id = request.POST.get("notification_id", None)
|
functionality_id = request.POST.get("functionality_id", None)
|
||||||
|
|
||||||
# gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||||
# row, created = Notification.objects.get_or_create(
|
functionality = get_object_or_404(ContentType, pk=functionality_id)
|
||||||
# user=request.user, gymnast=gymnast, functionality=notification_id
|
row, created = Notification.objects.get_or_create(
|
||||||
# )
|
user=request.user, gymnast=gymnast, functionality=functionality
|
||||||
|
)
|
||||||
|
|
||||||
# if created:
|
if created:
|
||||||
# return HttpResponse(200, (row, created)) # devrait être un 201
|
return HttpResponse(200, (row, created)) # devrait être un 201
|
||||||
# else:
|
else:
|
||||||
# return HttpResponse(400, (row, created))
|
return HttpResponse(400, (row, created))
|
||||||
|
|
||||||
|
|
||||||
# @require_http_methods(["POST"])
|
@require_http_methods(["POST"])
|
||||||
# def notification_remove(request):
|
def notification_remove(request):
|
||||||
# """
|
"""
|
||||||
# Supprime une demande de notification
|
Supprime une demande de notification
|
||||||
# """
|
"""
|
||||||
# gymnast_id = request.POST.get("gymnast_id", None)
|
gymnast_id = request.POST.get("gymnast_id", None)
|
||||||
# notification_id = request.POST.get("notification_id", None)
|
functionnality_id = request.POST.get("functionality_id", None)
|
||||||
|
|
||||||
# try:
|
try:
|
||||||
# Notification.objects.get(
|
Notification.objects.get(
|
||||||
# user=request.user, gymnast=gymnast_id, functionality=notification_id
|
user=request.user, gymnast=gymnast_id, functionality=functionnality_id
|
||||||
# ).delete()
|
).delete()
|
||||||
# except Exception:
|
except Exception:
|
||||||
# return HttpResponse(409)
|
return HttpResponse(409)
|
||||||
|
|
||||||
# return HttpResponse(200)
|
return HttpResponse(200)
|
||||||
|
|
Loading…
Reference in New Issue