三.1--modelform实现注册

1全局urls.py:

url(r'^reg/',views.reg),

2.crm/views.py:

#注册
def reg(request):
return render(request,'reg.html')

3.templates/reg.html:---从bootsrap中找https://v3.bootcss.com/:

(1)起步----登录页模版---把body块拿到reg.html中并把整个页面下载下来

(2)引入bootstarp:建static/plujins文件夹,并把Signin Template for Bootstrap_files文件夹重命名为bootstrap-3.3.7放在plujins目录中。

(3)并把css样式拷贝过来放static/css/reg.css中:

(4)引入form表单:bootstrap中找--css全局样式---水平排列的表单,把代码拷贝reg.html替换原来的form表单:

(5)创建crm/forms.py文件专门用来写form:

.先连接mysql数据库测试:如下

连接成功后看crm_userprofile表,字段太多:

猜你喜欢

转载自www.cnblogs.com/dbslinux/p/12029396.html