-
Notifications
You must be signed in to change notification settings - Fork 8
/
forms.py
28 lines (19 loc) · 913 Bytes
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from django import forms
from observation_portal.common.configdb import configdb
from observation_portal.proposals.models import TimeAllocation, CollaborationAllocation
class ProposalNotificationForm(forms.Form):
notifications_enabled = forms.BooleanField(required=False)
class CollaborationAllocationForm(forms.ModelForm):
class Meta:
model = CollaborationAllocation
fields = '__all__'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['telescope_name'] = forms.ChoiceField(choices=configdb.get_telescope_name_tuples())
class TimeAllocationForm(forms.ModelForm):
class Meta:
model = TimeAllocation
fields = '__all__'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['instrument_type'] = forms.ChoiceField(choices=configdb.get_instrument_type_tuples())