Skip to content

Commit a212a00

Browse files
committed
* Created contact form (django-contact-form didn't seem to offer any value over simple hand-rolled).
* Did some playing with styles to get it to look like the design. I think it's a decent start.
1 parent 32eb05e commit a212a00

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

pythonkc_site/forms.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
from django import forms
5+
6+
7+
class ContactForm(forms.Form):
8+
first_name = forms.CharField(
9+
widget=forms.TextInput(attrs={'placeholder': 'FIRST NAME',
10+
'class': 'contact-name'}))
11+
last_name = forms.CharField(
12+
widget=forms.TextInput(attrs={'placeholder': 'LAST NAME',
13+
'class': 'contact-name'}))
14+
email = forms.EmailField(
15+
widget=forms.TextInput(attrs={'placeholder': 'E-MAIL ADDRESS',
16+
'class': 'contact-email'}))
17+
message = forms.CharField(
18+
widget=forms.Textarea(attrs={'placeholder': 'MESSAGE',
19+
'class': 'contact-message',
20+
'rows': '3'}))

pythonkc_site/static/screen.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,13 @@ section.resources{
264264
font-weight: normal;
265265
font-size: 80%;
266266
}
267+
268+
.contact-name { width: 155px; border-color: #87CDED; }
269+
.contact-email { width: 200px; border-color: #87CDED; }
270+
.contact-message { width: 521px; border-color: #87CDED;
271+
font: 13px 'Helvetica Neue',Arial,Helvetica,sans-serif normal; }
272+
.contact-submit { color: #1B82B3; }
273+
274+
.contact-form input::-webkit-input-placeholder { background-color: #1B82B3; color: #87CDED; }
275+
.contact-form textarea::-webkit-input-placeholder { background-color: #1B82B3; color: #87CDED; }
276+
.contact-form *:-moz-placeholder { background-color: #1B82B3; color: #87CDED; }

pythonkc_site/templates/index.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,24 @@ <h1>FOLLOW US</h1>
120120
</ul>
121121
</article>
122122
</section>
123-
{% comment %}
124123
<section>
125124
<div id="contact-form">
125+
<form action="{% url home %}" method="post"
126+
enctype="application/x-www-form-urlencoded"
127+
class="contact-form">
128+
{% csrf_token %}
129+
{{ form.first_name }}
130+
{{ form.last_name }}
131+
{{ form.email }}
132+
{{ form.first_name.errors }}
133+
{{ form.last_name.errors }}
134+
{{ form.email.errors }}
135+
{{ form.message }}
136+
{{ form.message.errors }}
137+
<input type="submit" value="SUBMIT" class="contact-submit" />
138+
</form>
126139
</div>
127140
</section>
128-
{% endcomment %}
129141
<section>
130142
<div class="copyright">
131143
</div>

pythonkc_site/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
urlpatterns = patterns('',
1616

1717
url(r'^/?$', cache_page(60*60*24)(PythonKCComingSoon.as_view())),
18-
url(r'^demo/?$', cache_page(60 * 5)(PythonKCHome.as_view())),
18+
url(r'^demo/?$', cache_page(60 * 5)(PythonKCHome.as_view()), name='home'),
1919

2020
# Examples:
2121
# url(r'^$', 'pythonkc_site.views.home', name='home'),

pythonkc_site/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.conf import settings
55
from django.views.generic.base import TemplateView
66
from pythonkc_meetups import PythonKCMeetups
7+
from pythonkc_site.forms import ContactForm
78

89

910
try:
@@ -33,7 +34,8 @@ def get_past_events():
3334

3435
return {
3536
'next_event': get_next_event(),
36-
'past_events': get_past_events()
37+
'past_events': get_past_events(),
38+
'form': ContactForm()
3739
}
3840

3941

0 commit comments

Comments
 (0)