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

Brightcells 8 年之前
父节点
当前提交
3e0483e4b9
共有 1 个文件被更改,包括 2 次插入2 次删除
  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', '')