Skip to content

Commit

Permalink
Need to fix bootstraped buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
h205c committed Dec 20, 2019
1 parent 969735a commit 419fe62
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
10 changes: 10 additions & 0 deletions DRP/forms/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from django.contrib.auth import authenticate
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit


class UserCreationForm(DjangoUserCreationForm):
Expand All @@ -19,6 +21,14 @@ class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email')

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Register'))




class ConfirmationForm(DjangoAuthenticationForm):
"""A form for confirming a user's credentials, without checking if they are 'active'."""
Expand Down
8 changes: 8 additions & 0 deletions DRP/forms/contact.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""A module containing forms pertinent to contacting Managers."""
import django.forms as forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit


class ContactForm(forms.Form):
Expand All @@ -8,3 +10,9 @@ class ContactForm(forms.Form):
email = forms.EmailField(label="Your Email Address",
initial="[email protected]")
content = forms.CharField(label="Your Message", widget=forms.Textarea)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Send'))
Binary file added google-chrome-stable_current_amd64.deb
Binary file not shown.
9 changes: 5 additions & 4 deletions templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/infoForm.css" />
{% endblock %}

{% load crispy_forms_tags %}

{% block content %}
<h1 class='bannerText'>
Contact Us
</h1>
{% if success %}
<p>Thankyou for contributing to the dark reactions project. We'll get back to you soon.</p>
<p>Thank you for contributing to the Dark Reactions Project. We'll get back to you soon.</p>
{% else %}
<form method="post" action="/contact.html" class="inlineForm infoForm">
<form class="inlineForm infoForm">
{% csrf_token %}
<ol>
{{ form.as_ul }}
{% crispy form %}
</ol>
<input class="submit" type="submit" value="Send" />
</form>
{% endif %}
{% if testing %}
Expand Down
11 changes: 8 additions & 3 deletions templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/login_form.css" />
{% endblock %}

{% load crispy_forms_tags %}

{% block content %}

<form method="post" action="{% url 'login' %}{% if next %}?next={{ next|urlencode:"" }}{% endif %}">
<!-- d776703c-bf1c-4a0a-89d1-1fcd83093967 -->
{% csrf_token %}
<ol>
{{ form.as_ul }}
{% crispy form %}
</ol>
<input type="submit" value="Log In" />

<!-- <div class="text-center">
<button type="submit" class="btn btn-primary">Login</button>
</div> -->
<!-- <input type="submit" value="Log In" /> -->
</form>

<a id="registrationPrompt" href="/register.html" style="margin: 0 auto; display:block; text-align: center">Register an account</a>

{% endblock %}
11 changes: 8 additions & 3 deletions templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

{% block login_next %}{% endblock %}

{% load crispy_forms_tags %}

{% block content %}
<h1 class="bannerText">
Register
Expand All @@ -20,12 +22,15 @@ <h1 class="bannerText">
{% if testing %}
<!-- be088572-3adc-4757-8059-d16db2ea77a6 -->
{% endif %}
<form action="{% url 'register' %}" method="post">
<form action="{% url 'register' %}">
{% csrf_token %}
<ol>
{{ form.as_ul }}
{% crispy form %}
</ol>
<input type="submit" value="Register" />
<!-- <div class="text-center">
<button type="submit" class="btn btn-primary">Register</button>
</div> -->
<!-- <input type="submit" value="Register" /> -->
</form>
{% endif %}
{% if testing %}
Expand Down

0 comments on commit 419fe62

Please sign in to comment.