#add message

This commit is contained in:
xieshen 2021-01-07 15:59:41 +08:00
parent 44e9e65d37
commit 00fd97e0e0
1 changed files with 15 additions and 15 deletions

View File

@ -280,15 +280,15 @@ def group_update(request, pk):
d = '' d = ''
t = '' t = ''
v = '' v = ''
if group.province: if group.province != '' and group.province != 'None' :
p = Area_code_2020.objects.get(code=group.province).name p = Area_code_2020.objects.get(code=group.province).name
if group.cities: if group.cities and group.cities != 'None':
c = Area_code_2020.objects.get(code=group.cities).name c = Area_code_2020.objects.get(code=group.cities).name
if group.district: if group.district and group.district != 'None':
d = Area_code_2020.objects.get(code=group.district).name d = Area_code_2020.objects.get(code=group.district).name
if group.town: if group.town and group.town != 'None' :
t = Area_code_2020.objects.get(code=group.town).name t = Area_code_2020.objects.get(code=group.town).name
if group.village: if group.village and group.village != 'None':
v = Area_code_2020.objects.get(code=group.village).name v = Area_code_2020.objects.get(code=group.village).name
group_status_choices_list = [] group_status_choices_list = []
for g in range(2): for g in range(2):
@ -308,25 +308,25 @@ def group_update(request, pk):
o['username'] = g_a.user.username o['username'] = g_a.user.username
o['name'] = Userprofile.objects.get(user_id=g_a.user.id).name o['name'] = Userprofile.objects.get(user_id=g_a.user.id).name
o['organization'] = Userprofile.objects.get(user_id=g_a.user.id).organization.name o['organization'] = Userprofile.objects.get(user_id=g_a.user.id).organization.name
if g_a.group.province and g_a.group.cities and g_a.group.district and g_a.group.town and g_a.group.village: if g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None' and g_a.group.district and g_a.group.district != 'None' and g_a.group.town and g_a.group.town != 'None' and g_a.group.village and g_a.group.village != 'None':
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str( o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str( Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str( Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.town).name) + '-' + str( Area_code_2020.objects.get(code=g_a.group.town).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.village).name) Area_code_2020.objects.get(code=g_a.group.village).name)
elif g_a.group.province and g_a.group.cities and g_a.group.district and g_a.group.town: elif g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None' and g_a.group.district and g_a.group.district != 'None' and g_a.group.town and g_a.group.town != 'None':
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str( o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str( Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str( Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.town).name) Area_code_2020.objects.get(code=g_a.group.town).name)
elif g_a.group.province and g_a.group.cities and g_a.group.district: elif g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None' and g_a.group.district and g_a.group.district != 'None':
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str( o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str( Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.district).name) Area_code_2020.objects.get(code=g_a.group.district).name)
elif g_a.group.province and g_a.group.cities: elif g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None':
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str( o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_a.group.cities).name) Area_code_2020.objects.get(code=g_a.group.cities).name)
elif g_a.group.province: elif g_a.group.province and g_a.group.province != 'None':
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name)
g_a_list.append(o) g_a_list.append(o)
group_user = Group_user.objects.filter(group_id=pk) group_user = Group_user.objects.filter(group_id=pk)
@ -338,25 +338,25 @@ def group_update(request, pk):
i['username'] = g_u.user.username i['username'] = g_u.user.username
i['name'] = Userprofile.objects.get(user_id=g_u.user.id).name i['name'] = Userprofile.objects.get(user_id=g_u.user.id).name
i['organization'] = Userprofile.objects.get(user_id=g_u.user.id).organization.name i['organization'] = Userprofile.objects.get(user_id=g_u.user.id).organization.name
if g_u.group.province and g_u.group.cities and g_u.group.district and g_u.group.town and g_u.group.village: if g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None' and g_u.group.district and g_u.group.district != 'None' and g_u.group.town and g_u.group.town != 'None' and g_u.group.village and g_u.group.village != 'None':
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str( i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str( Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str( Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.town).name) + '-' + str( Area_code_2020.objects.get(code=g_u.group.town).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.village).name) Area_code_2020.objects.get(code=g_u.group.village).name)
elif g_u.group.province and g_u.group.cities and g_u.group.district and g_u.group.town: elif g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None' and g_u.group.district and g_u.group.district != 'None' and g_u.group.town and g_u.group.town != 'None':
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str( i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str( Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str( Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.town).name) Area_code_2020.objects.get(code=g_u.group.town).name)
elif g_u.group.province and g_u.group.cities and g_u.group.district: elif g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None' and g_u.group.district and g_u.group.district != 'None':
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str( i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str( Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.district).name) Area_code_2020.objects.get(code=g_u.group.district).name)
elif g_u.group.province and g_u.group.cities: elif g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None':
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str( i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
Area_code_2020.objects.get(code=g_u.group.cities).name) Area_code_2020.objects.get(code=g_u.group.cities).name)
elif g_u.group.province: elif g_u.group.province and g_u.group.province != 'None':
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name)
g_u_list.append(i) g_u_list.append(i)
if request.method == 'POST': if request.method == 'POST':