Commit 1af64677 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

created initial StudentForm with crispyforms

parent 0130102a
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, HTML
from crispy_forms.bootstrap import PrependedText, AppendedText, FormActions
from accounts.models import Student
# form to create student
class StudentForm( forms.ModelForm ):
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.layout = Layout(
PrependedText('room', 'Room'),
AppendedText('major', 'Major'),
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Submit'))
super(StudentForm, self).__init__(*args, **kwargs)
class Meta:
model = Student
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