root/webmanagement/project_request/forms.py

Revision 118, 2.8 kB (checked in by gallardj, 1 year ago)

Fixes #2591. HTML isn't allowed in form labels in django, so we moved the label into the template.

  • Property svn:executable set to *
Line 
1 from django import forms
2 from django.forms import widgets
3 import models
4 from webmanagement.GroupedChoiceField import GroupedChoiceField,GroupedSelect  #from http://www.djangosnippets.org/snippets/200/
5
6 # List comprehension to make a list of tuples in for format django likes
7 suggested_license = [(x.filename,x.name) for x in models.License.objects.filter(group='S')] #Suggested licenses
8 other_license = [(x.filename,x.name) for x in models.License.objects.filter(group='O')]  # Other Licenses
9
10
11 #combine license lists into the format that the GroupedChoiceField accepts
12 GROUPED_LICENSE_CHOICES = (('Suggested Licenses',suggested_license), ('Other Licenses',other_license))
13
14 class RequestForm(forms.Form):
15     name = forms.CharField(required=True, label="Project Name")
16     short_name = forms.CharField(required=True, label="Short Name", help_text="A single word or acronym for your project.  Using this, the URL for your project will be: http://beaversource.oregonstate.edu/projects/<short name>")
17     description = forms.Field(required=True, widget=widgets.Textarea(attrs={'rows':'4', 'cols':'25'}), label="Project Description", help_text="A sentence or two descripting the purpose of this project.")
18     owner = forms.CharField(required=True, help_text="ONID of the primary point of contact for administrative information.")
19     email = forms.EmailField(required=True, label="Owner Email", help_text="Email address for the primary contact person.")
20     purpose = forms.ChoiceField(widget=forms.Select(attrs={'onchange':'javascript:CheckChange(value);'}), required=True, choices=models.PURPOSE_OPTIONS, initial='I', help_text="If this project is for research, department, or a class project, select one of the other options, else just leave as individual")
21
22     dept = forms.CharField(required=False, label="Department name", help_text="The department (i.e. CS, HDFS, WR, etc) you are taking a class in that this project is used for")
23     term = forms.CharField(required=False, help_text="(i.e. Fall08, Winter09, etc)")
24
25     visibility = forms.ChoiceField(widget=forms.Select(attrs={'size':'5'}),choices=models.VISIBILITY_OPTIONS, required=True, label="Project Visibility", help_text=" If your project is being produced with University resources in the course of your regular work, please confirm with the OSU Research Office that it is okay for you to share it with the public.")
26     license = GroupedChoiceField(widget=GroupedSelect(attrs={'size':'20'}),choices=GROUPED_LICENSE_CHOICES, required=True, label="Intended License", help_text="It is the responsibility of the project owner to understand the license they select")
27     users = forms.Field(required=True, widget=widgets.Textarea(attrs={'rows':'4', 'cols':'25'}), label="Initial ONID Users", help_text="Seperate ONIDs with spaces or newlines")
28     AUP_Agree = forms.BooleanField(required=True)
Note: See TracBrowser for help on using the browser.