Reputation: 535
Goal is to implement a customized HTML template, that I've already created, for user signup form in Django.
I've looked at {{ form.as_p }} and crispy forms, but these options do not seem to allow me to space different fields at different lengths in the html. Such that First Name field and Last Name field are on row 1, email address completely takes up row two, and the two password fields are on the same row.
Upvotes: 0
Views: 530
Reputation: 5793
Create a login.html
template in templates/registration
and where you've declared your input fields either add name=first_name
etc (make sure you're using the field names used by Django, or use {{ form.first_name }}
etc for each field, assuming you're passing a form
Upvotes: 1
Reputation: 5361
Just start with something simple and then you can make it more fancy later. Try something like this:
HTML:
<form action="/action/path">
<input name="first_name" />
<input name="last_name" />
<input type="submit" />
</form>
View (/action/path
, or whatever you choose, should point to this view):
def register_view(request):
first_name = request.POST.get('first_name')
last_name = request.POST.get('last_name') # Repeat for all fields
User.objects.create_user(first_name=first_name, last_name=last_name, ...)
return redirect('/')
That's the basic gist of it. Make your own form and your own view for signing up. It will be the easiest way for you to do this.
Upvotes: 0