#更改数据库

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 http.client
import random
from django.utils import timezone
import time
from urllib import parse
from captcha.helpers import captcha_image_url
@ -250,7 +251,7 @@ def register(request):
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:
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_staff = True
# user.first_name = phone

View File

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

View File

@ -585,7 +585,7 @@ def organization_create(request):
else:
image = 'danweimoren.jpg'
organizationtype = request.POST.get('organizationtype')
# organizationtype = request.POST.get('organizationtype')
level_id = request.POST.get('level_id')
province = request.POST.get('province')
if province != '':
@ -602,7 +602,7 @@ def organization_create(request):
messages.error(request, '您注册的主体已经存在')
return HttpResponseRedirect('/management/organization/create/')
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,
village=village, level_id=level_id, status='0')
organization.save()