[chronojump-server] Updated all names to allow special chars



commit 677d536be31a980e8f40a7e68875e18b6ebd6888
Author: Max Ros i Morejon <mros33 gmail com>
Date:   Thu Jul 11 12:11:06 2019 +0200

    Updated all names to allow special chars

 .../chronojump_networks/organizations/api/views.py             | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/chronojumpserver-django/chronojump_networks/organizations/api/views.py 
b/chronojumpserver-django/chronojump_networks/organizations/api/views.py
index e7a719d..abdcf7a 100644
--- a/chronojumpserver-django/chronojump_networks/organizations/api/views.py
+++ b/chronojumpserver-django/chronojump_networks/organizations/api/views.py
@@ -129,7 +129,7 @@ class StationExercisesListView(ListCreateAPIView):
         o = Exercise.objects.create(
             station_id = int(data['station_id'][0]),
             percentBodyMassDisplaced = int(data['massp'][0]),
-            name = str(data['name'][0])
+            name = str(data['name'][0].encode('utf-8'))
         )
         s = ExerciseSerializer(o)
         return Response(s.data)
@@ -138,7 +138,7 @@ class StationExercisesListView(ListCreateAPIView):
         print("update exercise")
         data = dict(request.data)
         o = Exercise.objects.get(id=int(data['id'][0]))
-        o.name = str(data['name'][0])
+        o.name = str(data['name'][0].encode('utf-8'))
         o.station_id = int(data['station_id'][0])
         o.percentBodyMassDisplaced = float(data['massp'][0])
         o.organization_id = int(self.kwargs['organization_id'])
@@ -172,7 +172,7 @@ class PlayerListView(ListCreateAPIView):
             path = default_storage.save(full_path, ContentFile(photo.read()))
             print(new_photo)
         o = Player.objects.create(
-            name = str(data['name'][0]),
+            name = str(data['name'][0].encode('utf-8')),
             imageName = newimage,
             number = int(data['number'][0]),
             height = float(data['height'][0]),
@@ -241,7 +241,7 @@ class GroupListView(ListCreateAPIView):
         data = dict(request.data)
         # TODO: Sure there is a better way to do this
         o = Group.objects.create(
-            name = str(data['name'][0]),
+            name = str(data['name'][0].encode('utf-8')),
             gym_id = int(data['gym'][0]),
             responsible_id = int(data['responsible'][0]),
             organization_id = int(self.kwargs['organization_id'])
@@ -254,7 +254,7 @@ class GroupListView(ListCreateAPIView):
         #PROBLEMES AMB ACCENTS AL NOM DEL GRUP
         data = dict(request.data)
         o = Group.objects.get(id=int(data['id'][0]))
-        o.name = str(data['name'][0])
+        o.name = str(data['name'][0].encode('utf-8'))
         o.gym_id = int(data['gym'][0])
         o.responsible_id = int(data['responsible'][0])
         o.organization_id = int(self.kwargs['organization_id'])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]