forked from adeyosemanputra/pygoat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request adeyosemanputra#185 from sumukhchitloor/master
Fixes Registration form issue
- Loading branch information
Showing
5 changed files
with
100 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django import forms | ||
from django.contrib.auth.forms import UserCreationForm | ||
from django.contrib.auth.models import User | ||
|
||
|
||
# Create your forms here. | ||
|
||
class NewUserForm(UserCreationForm): | ||
email = forms.EmailField(required=True) | ||
|
||
class Meta: | ||
model = User | ||
fields = ("username", "email", "password1", "password2") | ||
|
||
def save(self, commit=True): | ||
user = super(NewUserForm, self).save(commit=False) | ||
user.email = self.cleaned_data['email'] | ||
if commit: | ||
user.save() | ||
return user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
{% extends "introduction/base.html" %} | ||
{% block content %} | ||
{% load crispy_forms_tags %} | ||
{% block content %} | ||
|
||
<div class="jumbotron"> | ||
<div class="contaniner"> | ||
<form method="post"> | ||
{% csrf_token %} | ||
{{form|crispy}} | ||
<button type="submit" class="btn btn-info btn-info">Register</button> | ||
</form> | ||
</div> | ||
{% load crispy_forms_tags %} | ||
|
||
<!--Register--> | ||
<div class="container py-5"> | ||
<h1>Register</h1> | ||
<form method="POST"> | ||
{% csrf_token %} | ||
{{ register_form|crispy }} | ||
<button class="btn btn-primary" type="submit">Register</button> | ||
</form> | ||
<p class="text-center">If you already have an account, <button type="submit" class="btn btn-info" style="margin-bottom:20px"><a href="/login" style="color: rgb(255, 255, 255); text-decoration: none;">Login</a></button> | ||
instead.</p> | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters