Django,Forms
Django, Forms 使用forms完成了用户登录 1、创建model class User(User): pass 这里使用了django提供的User类,直接继承 2、创建UserForm类 class SigninFrom(forms.Form): user_name = forms.CharField() user_email = forms.EmailField() user_password = forms.CharField() 3、完成模板 <form action="{% url 'permission:signin' %}" accept-charset="UTF-8" method="post"> <input name="utf8" type="hidden" value="✓"/> {% csrf_token %} <dl class="form-group mt-0"> <dt class="input-label"> <label class="form-label f5" for="user[login]">用户名</label> </dt> <input type="text" name="user_name" id="user_name" class="form-control form-control-lg input-block" placeholder="{{ default_name }}" autofocus> </dl> <dl class="form-group"> <dt class="input-label"> <label class="form-label f5" for="user[email]">Email</label> </dt> <dd> <input type="text" name="user_email" id="user_email" class="form-control form-control-lg input-block js-email-notice-trigger" placeholder="you@example....