장고에서 제공하는 CreateView를 통해 Account의 Create, 즉 회원가입을 구현해본다.
class AccountCreateView(CreateView):
model = User
form_class = UserCreationForm
success_url = reverse_lazy(’accountapp:hello_world’)
template_name = ‘accountapp/create.html’
path(’create/’, AccountCreateView.as_view(), name=’create’
{% extends ‘base.html’ %}
{% block content %}
<div style=”text-align: center”>
<form acrtion=”{% url ‘accountapp:create’ %}” method=”post”>
{% csrf_token %}
{{ form }}
<input type = “submit” class = “ btn btn-primary”>
</form>
</div>
{% enblock %}