-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jacobsaw
committed
Aug 11, 2016
1 parent
ae8802d
commit 412cace
Showing
17 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Binary file not shown.
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,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
Binary file not shown.
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,7 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class SurveyFormConfig(AppConfig): | ||
name = 'survey_form' |
Empty file.
Binary file not shown.
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,5 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models | ||
|
||
# Create your models here. |
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
AdamJacobs/Django/survey_form/static/survey_form/css/style.css
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,6 @@ | ||
#main{ | ||
margin:0px auto; | ||
width:300px; | ||
border:1px solid black; | ||
padding-left:20px; | ||
} |
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,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Survey Form</title> | ||
{% load staticfiles %} | ||
<link rel="stylesheet" type="text/css" href="{% static 'survey_form/css/style.css' %}"> | ||
</head> | ||
<body> | ||
<div id='main'> | ||
<form action='/process' method='post'> | ||
{% csrf_token %} | ||
<p>Your Name:<input type='text' name='name'></p> | ||
<p>Dojo Location:<select name='location'> | ||
<option value='Seattle'>Seattle</option> | ||
<option value='Washington, D.C.'>Washington, D.C.</option> | ||
<option value='Somehwere in Cali'>Somewhere in Cali</option> | ||
</select></p> | ||
<p>Favorite Language:<select name='language'> | ||
<option value='java'>java</option> | ||
<option value='python'>python</option> | ||
<option value='ruby'>ruby</option> | ||
</select></p> | ||
<p>Comment(optional:)</p> | ||
<textarea name='comment'> | ||
</textarea> | ||
<input type='submit' value='submit'> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
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,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Results</title> | ||
</head> | ||
<body> | ||
<div id='infobox'> | ||
<p>Thanks for submitting this form! You have submitted this form {{ request.session.run }} times now.</p> | ||
</div> | ||
<div id='submission'> | ||
<h4>Submitted Information</h4> | ||
<p>Name: {{ request.session.name }}</p> | ||
<p>Dojo Location: {{ request.session.location }}</p> | ||
<p>Favorite Language: {{ request.session.language }}</p> | ||
<p>Comment: {{ request.session.comment }}</p> | ||
</div> | ||
<p><a href='/survey'>Go Back</a></p> | ||
</body> | ||
</html> |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,8 @@ | ||
from django.conf.urls import url | ||
from . import views | ||
|
||
urlpatterns = [ | ||
url(r'^survey$', views.index), | ||
url(r'^survey/results$', views.results), | ||
url(r'^process$', views.process) | ||
] |
Binary file not shown.
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,26 @@ | ||
from django.shortcuts import render, redirect | ||
|
||
# Create your views here. | ||
def index(request): | ||
if 'run' in request.session: | ||
pass | ||
else: | ||
request.session['run'] = 0 | ||
return render(request, 'index.html') | ||
|
||
def results(request): | ||
return render(request, 'results.html') | ||
|
||
def process(request): | ||
if request.method == 'POST': | ||
request.session['name'] = request.POST['name'] | ||
request.session['location'] = request.POST['location'] | ||
request.session['language'] = request.POST['language'] | ||
if request.POST['comment']: | ||
request.session['comment'] = request.POST['comment'] | ||
else: | ||
request.session['comment'] = None | ||
request.session['run'] += 1 | ||
return redirect('/survey/results') | ||
else: | ||
return redirect('/survey') |
Binary file not shown.