#更改数据库

This commit is contained in:
Bob 2020-10-15 11:51:00 +08:00
parent 9a1f2fc207
commit fb2e227824
3 changed files with 14 additions and 13 deletions

View File

@ -1,6 +1,7 @@
import json import json
import http.client import http.client
import random import random
from django.utils import timezone
import time import time
from urllib import parse from urllib import parse
from captcha.helpers import captcha_image_url from captcha.helpers import captcha_image_url
@ -250,7 +251,7 @@ def register(request):
return HttpResponseRedirect('/register/') return HttpResponseRedirect('/register/')
if username is not None and password is not None and confirm_password is not None and email is not None and flag: if username is not None and password is not None and confirm_password is not None and email is not None and flag:
user = User.objects.create_user(username, email, password) user = User.objects.create_user(username, email, password,last_login = timezone.now() )
user.is_active = True user.is_active = True
# user.is_staff = True # user.is_staff = True
# user.first_name = phone # user.first_name = phone

View File

@ -61,16 +61,16 @@
</div> </div>
</label> </label>
</div> </div>
<div class="form-group"> {# <div class="form-group">#}
<label class="form-label" for="organizationtype">单位类型</label> {# <label class="form-label" for="organizationtype">单位类型</label>#}
<div class="controls"> {# <div class="controls">#}
<select class="form-control" name="organizationtype"> {# <select class="form-control" name="organizationtype">#}
{% for o in organizationtype %} {# {% for o in organizationtype %}#}
<option value="{{ o.id }}">{{ o.organizationtype }}</option> {# <option value="{{ o.id }}">{{ o.organizationtype }}</option>#}
{% endfor %} {# {% endfor %}#}
</select> {# </select>#}
</div> {# </div>#}
</div> {# </div>#}
<div class="form-group"> <div class="form-group">
<label class="form-label" for="administrativedivision">行政区划</label> <label class="form-label" for="administrativedivision">行政区划</label>
<div class="controls"> <div class="controls">

View File

@ -585,7 +585,7 @@ def organization_create(request):
else: else:
image = 'danweimoren.jpg' image = 'danweimoren.jpg'
organizationtype = request.POST.get('organizationtype') # organizationtype = request.POST.get('organizationtype')
level_id = request.POST.get('level_id') level_id = request.POST.get('level_id')
province = request.POST.get('province') province = request.POST.get('province')
if province != '': if province != '':
@ -602,7 +602,7 @@ def organization_create(request):
messages.error(request, '您注册的主体已经存在') messages.error(request, '您注册的主体已经存在')
return HttpResponseRedirect('/management/organization/create/') return HttpResponseRedirect('/management/organization/create/')
if name is not None: if name is not None:
organization = Organization(name=name, image=image, organizationtype_id=organizationtype, organization = Organization(name=name, image=image,
province=province, cities=city, district=district, town=town, province=province, cities=city, district=district, town=town,
village=village, level_id=level_id, status='0') village=village, level_id=level_id, status='0')
organization.save() organization.save()