Skip to content

Commit b94b0cf

Browse files
committed
PEP8, formatting etc.
1 parent badb4e7 commit b94b0cf

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

select_url_field/choice_with_other.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
from django import forms
22
from django.conf import settings
3-
from django.utils.encoding import force_unicode
3+
44

55
OTHER_CHOICE = '__other__'
6-
OTHER_CHOICE_DISPLAY = '' # 'Other:'
6+
OTHER_CHOICE_DISPLAY = '' # 'Other:'
7+
78

89
class ChoiceWithOtherWidget(forms.MultiWidget):
9-
"""MultiWidget for use with ChoiceWithOtherField."""
10+
11+
"""MultiWidget for use with ChoiceWithOtherField"""
12+
1013
def __init__(self, choices, attrs=None):
1114
widgets = [
1215
forms.Select(choices=choices),
@@ -26,13 +29,16 @@ def decompress(self, value):
2629
return ['', '']
2730

2831
def format_output(self, rendered_widgets):
32+
2933
"""Format the output by substituting the "other" choice into the first widget."""
34+
3035
return '<div class="choice_with_other_wrapper">%s %s</div>' % \
3136
(rendered_widgets[0], rendered_widgets[1])
3237

3338
def _media(self):
3439
js_list = ['%sadmin/choice_with_other.js' % settings.STATIC_URL, ]
3540
return forms.Media(js=js_list)
41+
3642
media = property(_media)
3743

3844

@@ -62,6 +68,8 @@ def compress(self, value):
6268
raise forms.ValidationError(self.error_messages['required'])
6369
if not value:
6470
return ''
65-
66-
return value[1] #value[0] is ignored. Only ever take the value from the text field. The select menu is now just a way to correctly fill in the text field.
71+
72+
# value[0] is ignored. Only ever take the value from the text field.
73+
# The select menu is just a way to correctly fill in the text field.
74+
return value[1]
6775

select_url_field/fields.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.db import models
88
from django.utils.translation import ugettext_lazy as _
99
from django.utils.encoding import smart_unicode
10+
1011
try:
1112
from importlib import import_module
1213
except ImportError:

0 commit comments

Comments
 (0)