histo_all
This commit is contained in:
@@ -15,30 +15,6 @@ from django.forms import formset_factory
|
||||
from utils import landingpages
|
||||
from metrics import axes
|
||||
|
||||
class SelectWidget(Select):
|
||||
"""
|
||||
Subclass of Django's select widget that allows disabling options.
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._disabled_choices = []
|
||||
super(SelectWidget, self).__init__(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def disabled_choices(self):
|
||||
return self._disabled_choices
|
||||
|
||||
@disabled_choices.setter
|
||||
def disabled_choices(self, other):
|
||||
self._disabled_choices = other
|
||||
|
||||
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
|
||||
option_dict = super(SelectWidget, self).create_option(
|
||||
name, value, label, selected, index, subindex=subindex, attrs=attrs
|
||||
)
|
||||
if value in self.disabled_choices:
|
||||
option_dict['attrs']['disabled'] = 'disabled'
|
||||
|
||||
return option_dict
|
||||
|
||||
# login form
|
||||
class LoginForm(forms.Form):
|
||||
@@ -963,11 +939,11 @@ class FlexAxesForm(forms.Form):
|
||||
|
||||
|
||||
xaxis = forms.ChoiceField(
|
||||
choices=axchoices,label='X-Axis',widget=SelectWidget,required=True)
|
||||
choices=axchoices,label='X-Axis',required=True)
|
||||
yaxis1 = forms.ChoiceField(
|
||||
choices=yaxchoices,label='Left Axis',widget=SelectWidget,required=True)
|
||||
choices=yaxchoices,label='Left Axis',required=True)
|
||||
yaxis2 = forms.ChoiceField(
|
||||
choices=yaxchoices2,label='Right Axis',widget=SelectWidget,required=True)
|
||||
choices=yaxchoices2,label='Right Axis',required=True)
|
||||
|
||||
def __init__(self,request,*args,**kwargs):
|
||||
super(FlexAxesForm, self).__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user