大家好,我正在尝试使用粗糙的表单来重新设计注册表单,但是,我似乎无法接受它。
这是我的register.html
screen.width
这是我在项目文件夹中的设置
{% extends "blog/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<form method="POST">
{% csrf_token %}
<fieldset class="form-group">
<legend class="border-bottom mb-4"> Join the Club</legend>
{{ form|crispy }}
</fieldset>
<div class="form-group"><button class="btn btn-outline-info" type="submit"> Join the Club!</button> </div>
</form>
<div class="border-top pt-3">
<small class="text-muted">Already have an account? <a class="ml-2" href="#">Submit </a>
</small>
</div>
</div>
{% endblock content%}
这是我在用户文件夹中的forms.py
INSTALLED_APPS = [
'blog.apps.BlogConfig',
'users.apps.UsersConfig',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
...
CRIPSY_TEMPLATE_PACK = 'bootstrap4'
这是我的终端机
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UserRegisterForm(UserCreationForm):
first_name = forms.CharField(max_length=30)
last_name = forms.CharField(max_length=30)
email = forms.EmailField(max_length=75)
class Meta:
model = User
fields = ['first_name','last_name', 'email','username','password1','password2']
我真的不明白我在这里做错了什么。如果有人可以帮助那将是很好的