1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

PEP8 fixes

This commit is contained in:
Jeremy Stretch
2017-05-11 17:54:43 -04:00
parent ed80bfaf02
commit e239045688
2 changed files with 7 additions and 7 deletions

View File

@ -1400,7 +1400,7 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
) )
rack_b = ChainedModelChoiceField( rack_b = ChainedModelChoiceField(
queryset=Rack.objects.all(), queryset=Rack.objects.all(),
chains = {'site': 'site_b'}, chains={'site': 'site_b'},
label='Rack', label='Rack',
required=False, required=False,
widget=APISelect( widget=APISelect(
@ -1410,7 +1410,7 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
) )
device_b = ChainedModelChoiceField( device_b = ChainedModelChoiceField(
queryset=Device.objects.all(), queryset=Device.objects.all(),
chains = {'site': 'site_b', 'rack': 'rack_b'}, chains={'site': 'site_b', 'rack': 'rack_b'},
label='Device', label='Device',
required=False, required=False,
widget=APISelect( widget=APISelect(
@ -1432,7 +1432,7 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
queryset=Interface.objects.exclude(form_factor__in=VIRTUAL_IFACE_TYPES).select_related( queryset=Interface.objects.exclude(form_factor__in=VIRTUAL_IFACE_TYPES).select_related(
'circuit_termination', 'connected_as_a', 'connected_as_b' 'circuit_termination', 'connected_as_a', 'connected_as_b'
), ),
chains = {'device': 'device_b'}, chains={'device': 'device_b'},
label='Interface', label='Interface',
widget=APISelect( widget=APISelect(
api_url='/api/dcim/interfaces/?device_id={{device_b}}&type=physical', api_url='/api/dcim/interfaces/?device_id={{device_b}}&type=physical',

View File

@ -335,14 +335,14 @@ class ChainedModelChoiceField(forms.ModelChoiceField):
""" """
A ModelChoiceField which is initialized based on the values of other fields within a form. `chains` is a dictionary A ModelChoiceField which is initialized based on the values of other fields within a form. `chains` is a dictionary
mapping of model fields to peer fields within the form. For example: mapping of model fields to peer fields within the form. For example:
country1 = forms.ModelChoiceField(queryset=Country.objects.all()) country1 = forms.ModelChoiceField(queryset=Country.objects.all())
city1 = ChainedModelChoiceField(queryset=City.objects.all(), chains={'country': 'country1'} city1 = ChainedModelChoiceField(queryset=City.objects.all(), chains={'country': 'country1'}
The queryset of the `city1` field will be modified as The queryset of the `city1` field will be modified as
.filter(country=<value>) .filter(country=<value>)
where <value> is the value of the `country1` field. (Note: The form must inherit from ChainedFieldsMixin.) where <value> is the value of the `country1` field. (Note: The form must inherit from ChainedFieldsMixin.)
""" """
def __init__(self, chains=None, *args, **kwargs): def __init__(self, chains=None, *args, **kwargs):