]> git.atlas4tour.it Git - pia_atlas.git/commitdiff
api
authorValeria Vitti <valeria.vitti@dyrecta.com>
Tue, 11 Jul 2023 15:03:53 +0000 (17:03 +0200)
committerValeria Vitti <valeria.vitti@dyrecta.com>
Tue, 11 Jul 2023 15:03:53 +0000 (17:03 +0200)
api/views.py
sistema/models.py
socoin_atlas/settings.py

index 8bc2904bd7a2afb008d1080dd1dbe70e87336c8e..ac115712295a5531d7b112ed61114a669974ed47 100644 (file)
@@ -126,6 +126,7 @@ class RegistrationAPI(APIView):
 
 
 class ListaPercorsiAPI(APIView):
+
     def get(self, request):
         errors = []
         error = False
@@ -218,16 +219,16 @@ class SendFeedbackAPI(APIView):
 
         if id_utente and id_percorso and valutazione:
 
-            utente = User.objects.get(pk=int(id_utente))
+            utente = User.objects.filter(pk=int(id_utente))
             if utente:
 
-                percorso = Percorso.objects.get(pk=int(id_percorso))
+                percorso = Percorso.objects.filter(pk=int(id_percorso))
                 if percorso:
 
                     try:
                         Feedback.objects.create(
-                            utente=utente,
-                            percorso=percorso,
+                            utente=utente.last(),
+                            percorso=percorso.last(),
                             valutazione=int(valutazione),
                             commento=commento
                         )
index b847717a71b3ef8e3167b342e92706a1d58f89ce..64138cd862791bb27e1cf79a1fd450c0188411e0 100644 (file)
@@ -121,4 +121,4 @@ class PoiSerializer(serializers.ModelSerializer):
 class MultimediaSerializer(serializers.ModelSerializer):
     class Meta:
         model = Multimedia
-        fields = ('id', 'nome', 'tipologia__nome', 'media', 'nome', 'descrizione', 'testo')
\ No newline at end of file
+        fields = ('id', 'nome', 'tipologia', 'media', 'nome', 'descrizione', 'testo')
\ No newline at end of file
index 64a8646d8820aa7616a46c1ad375d71ec59a7174..747dcb0385b6f9c1111d6b16fdf1b8d3671dd981 100644 (file)
@@ -42,6 +42,7 @@ INSTALLED_APPS = [
     'sistema',
     'utenti',
     'api',
+    'rest_framework'
 
 ]
 
@@ -63,6 +64,7 @@ REST_FRAMEWORK = {
         'rest_framework_simplejwt.authentication.JWTAuthentication',
         'rest_framework.authentication.SessionAuthentication',
         'rest_framework.authentication.BasicAuthentication',
+        'rest_framework.authentication.TokenAuthentication',
     ),
 }