first commit

This commit is contained in:
renjianbo
2026-01-09 18:28:10 +08:00
parent 8ca573e948
commit 5cc088a210
134 changed files with 8730 additions and 0 deletions

0
business/__init__.py Normal file
View File

91
business/admin.py Normal file
View File

@@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
from django.contrib import admin
from business.models import (AppConfigInfo, BusinessAccountInfo,
BusinessAppInfo, UserInfoImage, UserInfoRegex)
from utils.redis.rpageconfig import set_pageconfig, set_form_regex, rem_form_regex
class BusinessAccountInfoAdmin(admin.ModelAdmin):
"""
商家账户后台
"""
list_display = ('account_id', 'email', 'company_name', 'company_description', 'company_username', 'company_phone', 'company_location', 'status', 'created_at', 'updated_at')
list_filter = ('account_id', 'status')
readonly_fields = ('account_id',)
class BusinessAppInfoAdmin(admin.ModelAdmin):
"""
App信息后台
"""
list_display = ('account_id', 'app_id', 'app_name', 'app_description', 'status', 'created_at', 'updated_at')
list_filter = ('account_id', 'app_id', 'status')
readonly_fields = ('app_id',)
class AppConfigInfoAdmin(admin.ModelAdmin):
"""
App具体配置后台
"""
list_display = ('app_id', 'app_name', 'status', 'created_at', 'updated_at')
search_fields = ('app_id', 'app_name')
fieldsets = (
('None', {
'fields': ('app_id', 'app_name',)
}),
(u'文案配置', {
'classes': ('collapse',),
'fields': (
'rule_text',
),
}),
(u'显示信息相关', {
'classes': ('collapse',),
'fields': (
'is_show_userinfo', 'userinfo_fields', 'userinfo_field_names', 'option_fields',)
}),
)
def save_model(self, request, obj, form, change):
obj.save()
set_pageconfig(obj.data)
class UserInfoImageAdmin(admin.ModelAdmin):
"""
用户表单图片配置后台
"""
list_display = ('uii_name', 'status', 'created_at', 'updated_at')
def save_model(self, request, obj, form, change):
obj.save()
class UserInfoRegexAdmin(admin.ModelAdmin):
"""
用户表单正则表达式配置后台
"""
list_display = ('field_name', 'regex', 'description', 'status', 'created_at', 'updated_at')
list_filter = ('field_name',)
def save_model(self, request, obj, form, change):
set_form_regex(obj.field_name, obj.data)
obj.save()
def delete_model(self, request, obj):
rem_form_regex(obj.field_name)
obj.delete()
admin.site.register(BusinessAccountInfo, BusinessAccountInfoAdmin)
admin.site.register(BusinessAppInfo, BusinessAppInfoAdmin)
admin.site.register(AppConfigInfo, AppConfigInfoAdmin)
admin.site.register(UserInfoImage, UserInfoImageAdmin)
admin.site.register(UserInfoRegex, UserInfoRegexAdmin)

5
business/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class BusinessConfig(AppConfig):
name = 'business'

48
business/biz_render.py Normal file
View File

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
import time
from django.shortcuts import render
from django.contrib.auth.models import User
from business.models import BusinessAccountInfo
from account.models import Profile
def home(request):
uid = request.GET.get('uid', '') # 获取uid
try:
profile = Profile.objects.get(uid=uid) # 根据uid获取用户信息
except Profile.DoesNotExist:
profile = None # 未获取到用户信息profile变量置空
types = dict(BusinessAccountInfo.TYPE_CHOICES) # 所有的机构类型
return render(request, 'bussiness/index.html', { # 渲染视图,返回机构类型和是否存在该账户绑定过的机构账户
'types': types,
'is_company_user': bool(profile) and (profile.user_src == Profile.COMPANY_USER)
})
def notify(request):
email = request.GET.get('email', '')
bind = request.GET.get('bind', '')
time.sleep(.6)
try:
biz = BusinessAccountInfo.objects.get(email=email)
except BusinessAccountInfo.DoesNotExist:
biz = None
try:
profile = Profile.objects.get(email=email)
except Profile.DoesNotExist:
profile = None
try:
user = User.objects.get(email=email)
except User.DoesNotExist:
user = None
return render(request, 'bussiness/result.html', {
'is_registered': bool(biz) and bool(profile) and bool(user),
'bind': bind
})

79
business/biz_views.py Normal file
View File

@@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.conf import settings
from django.db import transaction
from django.views.decorators.csrf import csrf_exempt
from account.models import Profile
from business.models import BusinessAccountInfo
from utils.response import json_response
from utils.errors import BizError, UserError
def check_biz(request):
email = request.GET.get('email', '') # 获取邮箱
try: # 检查数据库中是否由该邮箱注册过的数据
biz = BusinessAccountInfo.objects.get(email=email)
except BusinessAccountInfo.DoesNotExist:
biz = None
return json_response(200, 'OK', { # 返回是否已经被注册过和是否已经有此用户
'userexists': User.objects.filter(email=email).exists(),
'bizaccountexists': bool(biz)
})
@csrf_exempt
@transaction.atomic
def registry_biz(request):
email = request.POST.get('email', '') # 获取填写的邮箱
name = request.POST.get('name', '') # 获取填写的机构名
username = request.POST.get('username', '') # 获取填写的机构联系人
phone = request.POST.get('phone', '') # 获取填写的手机号
ctype = request.POST.get('type', BusinessAccountInfo.INTERNET) # 获取机构类型
flag = int(request.POST.get('flag', 2)) # 获取一个标记位,代表用户是创建新用户还是使用绑定老用户的方式
uname = email.split('@')[0] # 和之前的注册逻辑没什么区别,创建一个账户名
if not User.objects.filter(username__exact=name).exists():
final_name = username
elif not User.objects.filter(username__exact=uname).exists():
final_name = uname
else:
final_name = email
if flag == 2: # 如果标记位是2,那么将为他创建新用户
user = User.objects.create_user(
username=final_name,
email=email,
password=settings.INIT_PASSWORD,
is_active=False,
is_staff=False
)
if flag == 1: # 如果标记位是1,那么为他绑定老用户
try:
user = User.objects.get(email=email)
except User.DoesNotExist:
return json_response(*UserError.UserNotFound)
pvalues = {
'phone': phone,
'name': final_name,
'user_src': Profile.COMPANY_USER,
}
profile, _ = Profile.objects.select_for_update().get_or_create(email=email) # 获取或创建用户信息
for k, v in pvalues.items():
setattr(profile, k, v)
profile.save()
bizvalues = {
'company_name': name,
'company_username': username,
'company_phone': phone,
'company_type': ctype,
}
biz, _ = BusinessAccountInfo.objects.select_for_update().get_or_create( # 获取或创建机构账户信息
email=email,
defaults=bizvalues
)
return json_response(200, 'OK', { # 响应JSON格式数据,这个标记位在发送验证邮件的时候还有用
'name': final_name,
'email': email,
'flag': flag
})

View File

@@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-03-28 04:52
from __future__ import unicode_literals
from django.db import migrations, models
import shortuuidfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AppConfigInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.BooleanField(db_index=True, default=True, help_text='状态', verbose_name='状态')),
('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间', verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间', verbose_name='更新时间')),
('app_id', models.CharField(db_index=True, help_text='应用唯一标识', max_length=32, verbose_name='应用id')),
('app_name', models.CharField(blank=True, help_text='应用名', max_length=40, null=True, verbose_name='应用名')),
('rule_text', models.TextField(blank=True, help_text='比赛规则', max_length=255, null=True, verbose_name='比赛规则')),
('is_show_userinfo', models.BooleanField(default=False, help_text='是否展示用户信息表单', verbose_name='展示用户表单')),
('userinfo_fields', models.CharField(blank=True, help_text='需要用户填写的字段#隔开', max_length=128, null=True, verbose_name='用户表单字段')),
('userinfo_field_names', models.CharField(blank=True, help_text='用户需要填写的表单字段label名称', max_length=128, null=True, verbose_name='用户表单label')),
('option_fields', models.CharField(blank=True, help_text='下拉框字段选项配置,#号隔开,每个字段由:h和,号组成。 如 option1:吃饭,喝水,睡觉#option2:上班,学习,看电影', max_length=128, null=True, verbose_name='下拉框字段')),
],
options={
'verbose_name': '应用配置信息',
'verbose_name_plural': '应用配置信息',
},
),
migrations.CreateModel(
name='BusinessAccountInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.BooleanField(db_index=True, default=True, help_text='状态', verbose_name='状态')),
('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间', verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间', verbose_name='更新时间')),
('account_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='出题账户唯一标识', max_length=22)),
('email', models.CharField(blank=True, db_index=True, help_text='邮箱', max_length=40, null=True, unique=True, verbose_name='邮箱')),
('company_name', models.CharField(blank=True, help_text='公司名称', max_length=60, null=True, verbose_name='公司名称')),
('company_description', models.TextField(blank=True, help_text='公司描述', null=True, verbose_name='公司描述')),
('company_username', models.CharField(blank=True, help_text='公司联系人', max_length=32, null=True, verbose_name='联系人')),
('company_phone', models.CharField(blank=True, db_index=True, help_text='公司联系电话', max_length=16, null=True, verbose_name='联系电话')),
('company_location', models.TextField(blank=True, help_text='公司联系地址', null=True, verbose_name='公司位置')),
],
options={
'verbose_name': '出题账户',
'verbose_name_plural': '出题账户',
},
),
migrations.CreateModel(
name='BusinessAppInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.BooleanField(db_index=True, default=True, help_text='状态', verbose_name='状态')),
('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间', verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间', verbose_name='更新时间')),
('account_id', models.CharField(db_index=True, help_text='出题账户唯一标识', max_length=32, verbose_name='出题账户id')),
('app_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='应用唯一标识', max_length=22)),
('app_name', models.CharField(blank=True, help_text='应用名', max_length=40, null=True, verbose_name='应用名')),
('app_description', models.TextField(blank=True, help_text='应用描述', null=True, verbose_name='应用描述')),
],
options={
'verbose_name': '应用信息',
'verbose_name_plural': '应用信息',
},
),
migrations.CreateModel(
name='UserInfoImage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.BooleanField(db_index=True, default=True, help_text='状态', verbose_name='状态')),
('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间', verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间', verbose_name='更新时间')),
('uii_name', models.CharField(blank=True, help_text='信息图片配置名称', max_length=32, null=True, verbose_name='配置名称')),
('name', models.CharField(blank=True, help_text='姓名', max_length=60, null=True, verbose_name='姓名')),
('sex', models.CharField(blank=True, help_text='性别', max_length=60, null=True, verbose_name='性别')),
('age', models.CharField(blank=True, help_text='年龄', max_length=60, null=True, verbose_name='年龄')),
('phone', models.CharField(blank=True, help_text='电话', max_length=60, null=True, verbose_name='手机号')),
('wxid', models.CharField(blank=True, help_text='微信号', max_length=60, null=True, verbose_name='微信号')),
('email', models.CharField(blank=True, help_text='邮箱', max_length=60, null=True, verbose_name='邮箱')),
('pid', models.CharField(blank=True, help_text='身份证号', max_length=60, null=True, verbose_name='身份证号')),
('graduated_from', models.CharField(blank=True, help_text='毕业院校', max_length=60, null=True, verbose_name='毕业院校')),
('address', models.CharField(blank=True, help_text='联系地址', max_length=60, null=True, verbose_name='地址')),
],
options={
'verbose_name': '用户信息图片配置',
'verbose_name_plural': '用户信息图片配置',
},
),
migrations.CreateModel(
name='UserInfoRegex',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.BooleanField(db_index=True, default=True, help_text='状态', verbose_name='状态')),
('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间', verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间', verbose_name='更新时间')),
('field_name', models.CharField(blank=True, help_text='字段名', max_length=16, null=True, verbose_name='字段名')),
('regex', models.CharField(blank=True, help_text='正则表达式', max_length=40, null=True, verbose_name='正则表达式值')),
('description', models.CharField(blank=True, help_text='错误描述', max_length=40, verbose_name='description')),
],
options={
'verbose_name': '用户信息字段正则表达式',
'verbose_name_plural': '用户信息字段正则表达式',
},
),
]

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-01 13:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='appconfiginfo',
name='file_fields',
field=models.CharField(blank=True, help_text='文件字段配置项,#号隔开', max_length=128, null=True, verbose_name='文件字段'),
),
]

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-01 14:13
from __future__ import unicode_literals
from django.db import migrations, models
import utils.basemodels
class Migration(migrations.Migration):
dependencies = [
('business', '0002_appconfiginfo_file_fields'),
]
operations = [
migrations.AddField(
model_name='userinfoimage',
name='resume',
field=models.FileField(blank=True, help_text='简历', null=True, upload_to=utils.basemodels.ModelHelper.upload_path, verbose_name='简历'),
),
]

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-01 14:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business', '0003_userinfoimage_resume'),
]
operations = [
migrations.AlterField(
model_name='userinfoimage',
name='resume',
field=models.CharField(blank=True, help_text='简历', max_length=60, null=True, verbose_name='简历'),
),
]

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-05 15:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business', '0004_auto_20180401_2221'),
]
operations = [
migrations.AddField(
model_name='businessaccountinfo',
name='company_type',
field=models.IntegerField(choices=[(0, '互联网'), (1, '金融'), (2, '能源'), (3, '基础建设'), (4, '交通'), (5, '通信')], default=0, help_text='公司类型', verbose_name='公司类型'),
),
migrations.AddField(
model_name='businessaccountinfo',
name='password',
field=models.CharField(blank=True, help_text='密码', max_length=20, null=True, verbose_name='密码'),
),
]

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-11 15:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('business', '0005_auto_20180405_2320'),
]
operations = [
migrations.RemoveField(
model_name='businessaccountinfo',
name='password',
),
]

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-12 08:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('business', '0006_remove_businessaccountinfo_password'),
]
operations = [
migrations.RemoveField(
model_name='appconfiginfo',
name='file_fields',
),
]

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-12 13:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('business', '0007_remove_appconfiginfo_file_fields'),
]
operations = [
migrations.RemoveField(
model_name='appconfiginfo',
name='userinfo_field_names',
),
]

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-04-12 13:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business', '0008_remove_appconfiginfo_userinfo_field_names'),
]
operations = [
migrations.AddField(
model_name='appconfiginfo',
name='userinfo_field_names',
field=models.CharField(blank=True, help_text='用户需要填写的表单字段label名称', max_length=128, null=True, verbose_name='用户表单label'),
),
]

View File

199
business/models.py Normal file
View File

@@ -0,0 +1,199 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from shortuuidfield import ShortUUIDField
from utils.basemodels import CreateUpdateMixin
class BusinessAccountInfo(CreateUpdateMixin):
""" 出题帐户类 """
INTERNET = 0
FINANCE = 1
ENERGY = 2
INFRASTRUCTURE = 3
TRANSPORTATION = 4
COMMUNICATION = 5
TYPE_CHOICES = (
(INTERNET, '互联网'),
(FINANCE, '金融'),
(ENERGY, '能源'),
(INFRASTRUCTURE, '基础建设'),
(TRANSPORTATION, '交通'),
(COMMUNICATION, '通信')
)
account_id = ShortUUIDField(_(u'出题账户id'), max_length=32, help_text=u'出题账户唯一标识', db_index=True)
# 帐户信息
email = models.CharField(_(u'邮箱'), max_length=40, blank=True, null=True, help_text=u'邮箱', db_index=True, unique=True)
# 公司信息
company_name = models.CharField(_(u'公司名称'), max_length=60, blank=True, null=True, help_text=u'公司名称')
company_type = models.IntegerField(_(u'公司类型'), choices=TYPE_CHOICES, default=INTERNET, help_text=u'公司类型')
company_description = models.TextField(_(u'公司描述'), blank=True, null=True, help_text=u'公司描述')
company_username = models.CharField(_(u'联系人'), max_length=32, blank=True, null=True, help_text=u'公司联系人')
company_phone = models.CharField(_(u'联系电话'), max_length=16, blank=True, null=True, help_text=u'公司联系电话', db_index=True)
company_location = models.TextField(_(u'公司位置'), blank=True, null=True, help_text=u'公司联系地址')
class Meta:
verbose_name = _(u'出题账户')
verbose_name_plural = _(u'出题账户')
def __unicode__(self):
return str(self.pk)
@property
def data(self):
return {
'email': self.email,
'company_name': self.company_name,
'company_type': self.company_type,
'company_location': self.company_location,
'company_username': self.company_username,
'company_phone': self.company_phone,
}
class BusinessAppInfo(CreateUpdateMixin):
""" 应用信息类 """
account_id = models.CharField(_(u'出题账户id'), max_length=32, help_text=u'出题账户唯一标识', db_index=True)
# APP 配置信息
app_id = ShortUUIDField(_(u'应用id'), max_length=32, help_text=u'应用唯一标识', db_index=True)
app_name = models.CharField(_(u'应用名'), max_length=40, blank=True, null=True, help_text=u'应用名')
app_description = models.TextField(_(u'应用描述'), blank=True, null=True, help_text=u'应用描述')
class Meta:
verbose_name = _(u'应用信息')
verbose_name_plural = _(u'应用信息')
def __unicode__(self):
return str(self.pk)
@property
def data(self):
return {
'app_id': self.app_id,
'app_name': self.app_name,
'account_id': self.account_id,
}
class AppConfigInfo(CreateUpdateMixin):
""" 应用配置信息类 """
app_id = models.CharField(_(u'应用id'), max_length=32, help_text=u'应用唯一标识', db_index=True)
app_name = models.CharField(_(u'应用名'), max_length=40, blank=True, null=True, help_text=u'应用名')
# 文案配置
rule_text = models.TextField(_(u'比赛规则'), max_length=255, blank=True, null=True, help_text=u'比赛规则')
# 显示信息
is_show_userinfo = models.BooleanField(_(u'展示用户表单'), default=False, help_text=u'是否展示用户信息表单')
userinfo_fields = models.CharField(_(u'用户表单字段'), max_length=128, blank=True, null=True, help_text=u'需要用户填写的字段#隔开')
userinfo_field_names = models.CharField(_('用户表单label'), max_length=128, blank=True, null=True, help_text=u'用户需要填写的表单字段label名称')
option_fields = models.CharField(_(u'下拉框字段'), max_length=128, blank=True, null=True, help_text=u'下拉框字段选项配置,#号隔开,每个字段由:h和,号组成。 如 option1:吃饭,喝水,睡觉#option2:上班,学习,看电影')
class Meta:
verbose_name = _(u'应用配置信息')
verbose_name_plural = _(u'应用配置信息')
def __unicode__(self):
return str(self.pk)
# 页面配置数据
@property
def show_info(self):
return {
'is_show_userinfo': self.is_show_userinfo,
'userinfo_fields': self.userinfo_fields,
'userinfo_field_names': self.userinfo_field_names,
'option_fields': self.option_fields,
}
@property
def text_info(self):
return {
'rule_text': self.rule_text,
}
@property
def data(self):
return {
'show_info': self.show_info,
'text_info': self.text_info,
'app_id': self.app_id,
'app_name': self.app_name
}
class UserInfoImage(CreateUpdateMixin):
"""
用户表单图片配置类
"""
uii_name = models.CharField(_(u'配置名称'), max_length=32, blank=True, null=True, help_text=u'信息图片配置名称')
# 用户信息
name = models.CharField(_(u'姓名'), max_length=60, blank=True, null=True, help_text=u'姓名')
sex = models.CharField(_(u'性别'), max_length=60, blank=True, null=True, help_text=u'性别')
age = models.CharField(_(u'年龄'), max_length=60, blank=True, null=True, help_text=u'年龄')
phone = models.CharField(_(u'手机号'), max_length=60, blank=True, null=True, help_text=u'电话')
wxid = models.CharField(_(u'微信号'), max_length=60, blank=True, null=True, help_text=u'微信号')
email = models.CharField(_(u'邮箱'), max_length=60, blank=True, null=True, help_text=u'邮箱')
pid = models.CharField(_(u'身份证号'), max_length=60, blank=True, null=True, help_text=u'身份证号')
graduated_from = models.CharField(_(u'毕业院校'), max_length=60, blank=True, null=True, help_text=u'毕业院校')
address = models.CharField(_(u'地址'), max_length=60, blank=True, null=True, help_text=u'联系地址')
resume = models.CharField(_(u'简历'), max_length=60, blank=True, null=True, help_text=u'简历')
class Meta:
verbose_name = _(u'用户信息图片配置')
verbose_name_plural = _(u'用户信息图片配置')
def __unicode__(self):
return str(self.pk)
@property
def data(self):
return {
'name': self.name,
'sex': self.sex,
'age': self.age,
'phone': self.phone,
'wxid': self.wxid,
'email': self.email,
'pid': self.pid,
'graduated_from': self.graduated_from,
'address': self.address,
}
class UserInfoRegex(CreateUpdateMixin):
"""
用户正则表达式配置类
"""
field_name = models.CharField(_(u'字段名'), max_length=16, blank=True, null=True, help_text=u'字段名')
regex = models.CharField(_(u'正则表达式值'), max_length=40, blank=True, null=True, help_text=u'正则表达式')
description = models.CharField(_(u'description'), max_length=40, blank=True, help_text=u'错误描述')
class Meta:
verbose_name = _(u'用户信息字段正则表达式')
verbose_name_plural = _(u'用户信息字段正则表达式')
def __unicode__(self):
return self.field_name
@property
def data(self):
return {
'field_name': self.field_name,
'regex': self.regex,
'description': self.description,
}

3
business/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

12
business/urls.py Normal file
View File

@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
from django.conf.urls import url
from business import biz_render
from django.urls import path
urlpatterns = [
path('', biz_render.home, name='index'),
path('notify', biz_render.notify, name='notify'),
]

3
business/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.