Commit 34df1bd9 authored by Ben Waters's avatar Ben Waters

using floppy forms

parent 1ebd44fb
from django import forms
import floppyforms as forms
from django.db import models
from django.core.exceptions import ValidationError
from mainapp.models import Student, Major, Minor, GenEd
# form on new page
class StartTrajectoryForm(forms.Form):
majors = forms.ChoiceField(choices=[(obj.id, obj.name) for obj in
majors = forms.ChoiceField(widget=forms.SelectMultiple,choices=[(obj.id, obj.name) for obj in
Major.objects.all()])
minors = forms.ChoiceField(choices=[(obj.id, obj.name) for obj in
minors = forms.ChoiceField(widget=forms.SelectMultiple,choices=[(obj.id, obj.name) for obj in
Minor.objects.all()])
class StudentForm(forms.ModelForm):
......
......@@ -19,48 +19,7 @@ New | MySchool Advisor
<div class="col-md-offset-1 col-md-10 well">
<form class="form-horizontal" action="{% url 'build-me' %}" method="post" role="form" enctype="multipart/form-data">
{% csrf_token %}
<fieldset>
<legend>Select your program(s).</legend>
<div class="form-group{% if starttrajectoryform.name.errors %} has-error {% endif %}">
<label for "{{ starttrajectoryform.name.id_for_label}}" class="col-sm-2">
{{ starttrajectoryform.name.id_for_label }}</label>
<div class="col-sm-8">
{{ starttrajectoryform.name }}
{% for error in starttrajectoryform.name.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
<!-- autocompletion would be awesome -->
</div>
<select multiple class="form-control">
{% for major in starttrajectoryform.majors.field.choices %}
<option value="{{major.id}}">{{major}}</option>
{% endfor %}
</select>
</div>
<!-- Javascript for adding an additional field -->
<!-- Ensure no more than two majors -->
<legend>Select your minor(s).</legend>
<div class="form-group{% if starttrajectoryform.name.errors %} has-error {% endif %}">
<label for "{{ starttrajectoryform.name.id_for_label }}" class="col-sm-2">
{{ starttrajectoryform.name.id_for_label }}</label>
<div class="col-sm-8">
{{ starttrajectoryform.name }}
{% for error in starttrajectoryform.name.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
<!-- autocompletion would be awesome -->
</div>
<select multiple class="form-control">
{% for minor in starttrajectoryform.minors.fieldchoices %}
<option value="{{minor.id}}">{{minor}}</option>
{% endfor %}
</select>
</div>
{{ starttrajectoryform.as_p }}
<!-- Javascript for adding an additional field -->
<!-- ensure no more than three minors -->
......@@ -71,7 +30,6 @@ New | MySchool Advisor
</div>
</div>
</fieldset>
</form>
</div>
</div>
......
......@@ -20,6 +20,9 @@ from mainapp.forms import StartTrajectoryForm, StudentForm
@login_required
def build_trajectory(request):
#process
if request.method == "POST":
form = StartTrajectoryForm(request.POST)
#majors = form.fie
return render_to_response('build.html', {
})
class StartTrajectoryView(FormView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment