args.update(csrf(request))
def register_user(request):
if request.method == 'POST':
form = MyRegistrationForm(request.POST) # create form object
if form.is_valid():
form.save()
return HttpResponseRedirect('/register/')
else:
print (form.errors)
args = {}
args.update(csrf(request))
args['form'] = MyRegistrationForm()
print (args)
return render(request, 'register.html', args)
<div class="input-field col-md-12">
<div class="row">
{{ form.username }}
<label for="nick_name">Нікнейм</label>
</div>
</div>
<div class="input-field col-md-6">
{{ form.first_name }}
<label for="first_name">Ім’я</label>
</div>
<div class="input-field col-md-6">
{{ form.last_name }}
<label for="last_name">Прізвище</label>
</div>