html_forms.py 1.5 KB
Newer Older
jtchilders's avatar
jtchilders committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

from __future__ import absolute_import, unicode_literals

import copy
from itertools import chain
import warnings

#from django.conf import settings
#from django.forms.util import flatatt, to_current_timezone
#from django.utils.datastructures import MultiValueDict, MergeDict
#from django.utils.html import conditional_escape, format_html
#from django.utils.translation import ugettext_lazy
#from django.utils.encoding import force_text, python_2_unicode_compatible
#from django.utils.safestring import mark_safe
#from django.utils import datetime_safe, formats, six
#from django.utils.six.moves.urllib.parse import urljoin

from django import forms
from django.forms.widgets import CheckboxInput

21
from balsam.argo import models
jtchilders's avatar
jtchilders committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import logging
logger = logging.getLogger(__name__)

list_of_tuples = []
for state in models.STATES:
   list_of_tuples.append( (state.name,state.name) )
ALL_STATES = tuple(list_of_tuples)

class JobDisplayForm(forms.Form):
   state             = forms.ChoiceField(required=True,widget=forms.Select,choices=ALL_STATES)
   group_identifier  = forms.CharField(required=True,widget=forms.TextInput(attrs={'size':150}))
   email             = forms.CharField(required=True,widget=forms.TextInput(attrs={'size':150}))
   confirm_delete    = forms.BooleanField(required=False)

   def __init__(self, current_subjob_choices=[('-1','no choices')], *args, **kwargs):
      super(JobDisplayForm, self).__init__(*args, **kwargs)
      self.fields['current_subjob'] = forms.ChoiceField(choices=current_subjob_choices)