From: Valeria Vitti Date: Tue, 11 Jul 2023 15:03:53 +0000 (+0200) Subject: api X-Git-Url: https://git.atlas4tour.it/?a=commitdiff_plain;h=81dee6bda3f8044f7718fdeedf3055939082e1f7;p=pia_atlas.git api --- diff --git a/api/views.py b/api/views.py index 8bc2904..ac11571 100644 --- a/api/views.py +++ b/api/views.py @@ -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 ) diff --git a/sistema/models.py b/sistema/models.py index b847717..64138cd 100644 --- a/sistema/models.py +++ b/sistema/models.py @@ -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 diff --git a/socoin_atlas/settings.py b/socoin_atlas/settings.py index 64a8646..747dcb0 100644 --- a/socoin_atlas/settings.py +++ b/socoin_atlas/settings.py @@ -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', ), }