Fix Bug: invalid literal for int() with base 10: ''

Brightcells %!s(int64=8) %!d(string=hace) años
padre
commit
3e0483e4b9
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      group/tourguidegroup_views.py

+ 2 - 2
group/tourguidegroup_views.py

@@ -33,7 +33,7 @@ def tg_group_create_api(request):
33 33
     group_default_avatar = int(request.POST.get('group_default_avatar', 0))
34 34
     started_at = tc.utc_string_to_utc_datetime(request.POST.get('started_at', ''))  # UTC, %Y-%m-%dT%H:%M:%SZ
35 35
     ended_at = tc.utc_string_to_utc_datetime(request.POST.get('ended_at', ''))  # UTC, %Y-%m-%dT%H:%M:%SZ
36
-    total_persons = request.POST.get('total_persons', '')
36
+    total_persons = int(request.POST.get('total_persons', 1))
37 37
 
38 38
     # 用户校验
39 39
     try:
@@ -143,7 +143,7 @@ def tg_group_update_api(request):
143 143
 
144 144
     started_at = tc.utc_string_to_utc_datetime(request.POST.get('started_at', ''))  # UTC, %Y-%m-%dT%H:%M:%SZ
145 145
     ended_at = tc.utc_string_to_utc_datetime(request.POST.get('ended_at', ''))  # UTC, %Y-%m-%dT%H:%M:%SZ
146
-    total_persons = request.POST.get('total_persons', '')
146
+    total_persons = int(request.POST.get('total_persons', 0))
147 147
 
148 148
     attentions = request.FILES.get('attentions', '')
149 149
     schedules = request.FILES.get('schedules', '')