예제 #1
0
파일: forms.py 프로젝트: nilsfriess/muesli
 def __init__(self, request):
     self.request = request
     formfields = [
         FormField(
             'type',
             label='Typ',
             type='select',
             options=[[type, data['name']] for type, data in list(
                 request.config['lecture_types'].items())],
             #value=lecture.type,
             required=True),
         FormField(
             'name',
             label='Name',
             type='text',
             size=100,
             #value=lecture.name,
             required=True),
         FormField(
             'term',
             label='Semester',
             type='select',
             options=utils.getTerms(),
             #value=lecture.term
         ),
         FormField(
             'lsf_id',
             label='Veranstaltungsnummer',
             type='text',
             size=20,
             #value=lecture.lsf_id
         ),
         FormField(
             'lecturer',
             label='Dozent',
             type='text',
             size=40,
             #value=lecture.lecturer
         ),
         FormField(
             'url',
             label='Homepage',
             size=100,
             #value=lecture.url
         ),
     ]
     if request.permissionInfo.has_permission('change_assistant'):
         assistants = request.db.query(
             models.User).filter(models.User.is_assistant == 1).order_by(
                 models.User.last_name).all()
         formfields.append(
             FormField(
                 'assistant',
                 label='Assistent',
                 type='select',
                 options=[[a.id, str(a)] for a in assistants],
                 #value=lecture.assistant.id,
                 required=True,
             ))
     ObjectForm.__init__(self, None, formfields, request, send='Anlegen')
예제 #2
0
파일: forms.py 프로젝트: tynsh/muesli
 def __init__(self, request, lecture):
     self.request = request
     formfields = [
         FormField(
             "type",
             label="Typ",
             type="select",
             options=[[type, data["name"]] for type, data in request.config["lecture_types"].items()],
             value=lecture.type,
             required=True,
         ),
         FormField("name", label="Name", type="text", size=100, value=lecture.name, required=True),
         FormField("term", label="Semester", type="select", options=utils.getTerms(), value=lecture.term),
         FormField("lsf_id", label="Veranstaltungsnummer", type="text", size=20, value=lecture.lsf_id),
         FormField("lecturer", label="Dozent", type="text", size=40, value=lecture.lecturer),
         FormField("url", label="Homepage", size=100, value=lecture.url),
         FormField("mode", label="Anmeldemodus", type="select", options=utils.modes, value=lecture.mode),
         FormField(
             "minimum_preferences",
             label=u"Minimum möglicher Termine",
             size=5,
             comment=u"Bei Präferenzenanmeldung: Studenten müssen mindestens an soviel Terminen können. (Leer: Defaultformel)",
             value=lecture.minimum_preferences,
             validator=validators.Int(),
         ),
         FormField(
             "tutor_rights",
             label=u"Tutorenrechte",
             type="select",
             options=utils.tutorRights,
             value=lecture.tutor_rights,
         ),
         FormField(
             "password",
             label=u"Passwort für Übungsleiter",
             size=40,
             comment=u"Bei leerem Passwort keine Anmeldung als Übungsleiter möglich",
             value=lecture.password,
         ),
         FormField(
             "is_visible",
             label="Sichtbar",
             type="radio",
             options=[[1, "Ja"], [0, "Nein"]],
             value=boolToValue(lecture.is_visible),
         ),
     ]
     # if request.permissionInfo.has_permission('change_assistant'):
     # assistants = request.db.query(models.User).filter(models.User.is_assistant==1).order_by(models.User.last_name).all()
     # formfields.append(
     # FormField('assistant',
     # label='Assistent',
     # type='select',
     # options=[[a.id, unicode(a)] for a in assistants],
     # value=lecture.assistant.id,
     # required=True,
     # ))
     ObjectForm.__init__(self, lecture, formfields, request, send=u"Ändern")
예제 #3
0
파일: forms.py 프로젝트: dotlambda/muesli
	def __init__(self, request):
		self.request =  request
		formfields = [
			FormField('type',
			   label='Typ',
			   type='select',
			   options=[[type, data['name']] for type, data in request.config['lecture_types'].items()],
			   #value=lecture.type,
			   required=True),
			FormField('name',
			   label='Name',
			   type='text',
			   size=100,
			   #value=lecture.name,
			   required=True),
			FormField('term',
			   label='Semester',
			   type='select',
			   options=utils.getTerms(),
			   #value=lecture.term
			   ),
			FormField('lsf_id',
			   label='Veranstaltungsnummer',
			   type='text',
			   size=20,
			   #value=lecture.lsf_id
			   ),
			FormField('lecturer',
			   label='Dozent',
			   type='text',
			   size=40,
			   #value=lecture.lecturer
			   ),
			FormField('url',
			   label='Homepage',
			   size=100,
			   #value=lecture.url
			   ),
			]
		if request.permissionInfo.has_permission('change_assistant'):
			assistants = request.db.query(models.User).filter(models.User.is_assistant==1).order_by(models.User.last_name).all()
			formfields.append(
			  FormField('assistant',
			   label='Assistent',
			   type='select',
			   options=[[a.id, unicode(a)] for a in assistants],
			   #value=lecture.assistant.id,
			   required=True,
			   ))
		ObjectForm.__init__(self, None, formfields, request, send=u'Anlegen')
예제 #4
0
파일: models.py 프로젝트: erichhasl/muesli
 def load_term(self, value):
     term = [Term(str(value)), Term(str(value))]
     if term in getTerms():
         return term[0]
예제 #5
0
파일: forms.py 프로젝트: nilsfriess/muesli
 def __init__(self, request, lecture):
     self.request = request
     formfields = [
         FormField('type',
                   label='Typ',
                   type='select',
                   options=[[type, data['name']] for type, data in list(
                       request.config['lecture_types'].items())],
                   value=lecture.type,
                   required=True),
         FormField('name',
                   label='Name',
                   type='text',
                   size=100,
                   value=lecture.name,
                   required=True),
         FormField('term',
                   label='Semester',
                   type='select',
                   options=utils.getTerms(),
                   value=lecture.term),
         FormField('lsf_id',
                   label='Veranstaltungsnummer',
                   type='text',
                   size=20,
                   value=lecture.lsf_id),
         FormField('lecturer',
                   label='Dozent',
                   type='text',
                   size=40,
                   value=lecture.lecturer),
         FormField('url', label='Homepage', size=100, value=lecture.url),
         FormField('mode',
                   label='Anmeldemodus',
                   type='select',
                   options=utils.modes,
                   value=lecture.mode),
         FormField(
             'minimum_preferences',
             label='Minimum möglicher Termine',
             size=5,
             comment=
             'Bei Präferenzenanmeldung: Studenten müssen mindestens an soviel Terminen können. (Leer: Defaultformel)',
             value=lecture.minimum_preferences,
             validator=validators.Int()),
         FormField('tutor_rights',
                   label='Tutorenrechte',
                   type='select',
                   options=utils.tutorRights,
                   value=lecture.tutor_rights),
         FormField(
             'password',
             label='Passwort für Übungsleiter',
             size=40,
             comment=
             'Bei leerem Passwort keine Anmeldung als Übungsleiter möglich',
             value=lecture.password),
         FormField('is_visible',
                   label='Sichtbar',
                   type='radio',
                   options=[[1, 'Ja'], [0, 'Nein']],
                   value=boolToValue(lecture.is_visible))
     ]
     #if request.permissionInfo.has_permission('change_assistant'):
     #assistants = request.db.query(models.User).filter(models.User.is_assistant==1).order_by(models.User.last_name).all()
     #formfields.append(
     #FormField('assistant',
     #label='Assistent',
     #type='select',
     #options=[[a.id, unicode(a)] for a in assistants],
     #value=lecture.assistant.id,
     #required=True,
     #))
     ObjectForm.__init__(self, lecture, formfields, request, send='Ändern')
예제 #6
0
파일: forms.py 프로젝트: dotlambda/muesli
	def __init__(self, request, lecture):
		self.request = request
		formfields = [
			FormField('type',
			   label='Typ',
			   type='select',
			   options=[[type, data['name']] for type, data in request.config['lecture_types'].items()],
			   value=lecture.type,
			   required=True),
			FormField('name',
			   label='Name',
			   type='text',
			   size=100,
			   value=lecture.name,
			   required=True),
			FormField('term',
			   label='Semester',
			   type='select',
			   options=utils.getTerms(),
			   value=lecture.term),
			FormField('lsf_id',
			   label='Veranstaltungsnummer',
			   type='text',
			   size=20,
			   value=lecture.lsf_id),
			FormField('lecturer',
			   label='Dozent',
			   type='text',
			   size=40,
			   value=lecture.lecturer),
			FormField('url',
			   label='Homepage',
			   size=100,
			   value=lecture.url),
			FormField('mode',
			   label='Anmeldemodus',
			   type='select',
			   options=utils.modes,
			   value=lecture.mode),
			FormField('minimum_preferences',
			   label=u'Minimum möglicher Termine',
			   size=5,
			   comment=u'Bei Präferenzenanmeldung: Studenten müssen mindestens an soviel Terminen können. (Leer: Defaultformel)',
			   value=lecture.minimum_preferences,
			   validator=validators.Int()),
			FormField('tutor_rights',
			    label=u'Tutorenrechte',
			    type='select',
			    options=utils.tutorRights,
			    value=lecture.tutor_rights),
			FormField('password',
			   label=u'Passwort für Übungsleiter',
			   size=40,
			   comment=u'Bei leerem Passwort keine Anmeldung als Übungsleiter möglich',
			   value=lecture.password),
			FormField('is_visible',
			   label='Sichtbar',
			   type='radio',
			   options=[[1, 'Ja'], [0, 'Nein']],
			   value=boolToValue(lecture.is_visible))
			]
		#if request.permissionInfo.has_permission('change_assistant'):
			#assistants = request.db.query(models.User).filter(models.User.is_assistant==1).order_by(models.User.last_name).all()
			#formfields.append(
			  #FormField('assistant',
			   #label='Assistent',
			   #type='select',
			   #options=[[a.id, unicode(a)] for a in assistants],
			   #value=lecture.assistant.id,
			   #required=True,
			   #))
		ObjectForm.__init__(self, lecture, formfields, request, send=u'Ändern')
예제 #7
0
파일: forms.py 프로젝트: tynsh/muesli
 def __init__(self, request):
     self.request = request
     formfields = [
         FormField(
             "type",
             label="Typ",
             type="select",
             options=[[type, data["name"]] for type, data in request.config["lecture_types"].items()],
             # value=lecture.type,
             required=True,
         ),
         FormField(
             "name",
             label="Name",
             type="text",
             size=100,
             # value=lecture.name,
             required=True,
         ),
         FormField(
             "term",
             label="Semester",
             type="select",
             options=utils.getTerms(),
             # value=lecture.term
         ),
         FormField(
             "lsf_id",
             label="Veranstaltungsnummer",
             type="text",
             size=20,
             # value=lecture.lsf_id
         ),
         FormField(
             "lecturer",
             label="Dozent",
             type="text",
             size=40,
             # value=lecture.lecturer
         ),
         FormField(
             "url",
             label="Homepage",
             size=100,
             # value=lecture.url
         ),
     ]
     if request.permissionInfo.has_permission("change_assistant"):
         assistants = (
             request.db.query(models.User)
             .filter(models.User.is_assistant == 1)
             .order_by(models.User.last_name)
             .all()
         )
         formfields.append(
             FormField(
                 "assistant",
                 label="Assistent",
                 type="select",
                 options=[[a.id, unicode(a)] for a in assistants],
                 # value=lecture.assistant.id,
                 required=True,
             )
         )
     ObjectForm.__init__(self, None, formfields, request, send=u"Anlegen")