forms.py 1.22 KB
Newer Older
Daniel W Bond's avatar
Daniel W Bond committed
1
2
3
4
5
6
from django import forms
from django.db import models
from django.core.exceptions import ValidationError
from django.forms import ModelForm, Select
from trajectories.models import Trajectory

Daniel W Bond's avatar
Daniel W Bond committed
7
8
9
10
11
12
13
14
15
16
17
18
19
from haystack.forms import SearchForm

class StyledSeachForm( SearchForm ):
    q = forms.CharField(
        required = False,
	label = 'Search',
	widget = forms.TextInput(attrs={
	    'class' : 'form-control',
	    'placeholder' : 'Search',
	    'autofocus' : 'autofocus',
        }),
    )

Daniel W Bond's avatar
Daniel W Bond committed
20
21
22
23
24
25
26
27
28
29
30
31
# class SelectYourCourses( ModelForm ):

    # class Meta:
        # models = Course

	# widgets = {
	    # department abbreviation

	    # course number

	    # name

Daniel W Bond's avatar
Daniel W Bond committed
32
33
34
35
36
class NewTrajectoryForm( ModelForm ):
    # def __init__(self, *args, **kwargs):

    class Meta:
        model = Trajectory
Daniel W Bond's avatar
Daniel W Bond committed
37
        fields = ('name', 'degreeType', 'programType',
Daniel W Bond's avatar
Daniel W Bond committed
38
        )
Daniel W Bond's avatar
Daniel W Bond committed
39
40
        exclude = ('courseReqs', 'created', 'last_modified', 'catalogYear',
	    'isCompleted',
Daniel W Bond's avatar
Daniel W Bond committed
41
42
        )
        widgets = {
Daniel W Bond's avatar
Daniel W Bond committed
43
44
45
46
47
48
49
50
51
52
	    # name of major(s)
            'name' : TextInput(attrs={
	        'class' : 'form-control',
		'placeholder' : 'Government and International Politics',
	    }),
            # name of minor(s)
            
	    # are you in the honors college?

	    # current semester
Daniel W Bond's avatar
Daniel W Bond committed
53
        }