Skip to content

Commit 8d8dbef

Browse files
authored
Merge pull request #254 from TechnoLoft/general_flake8
General Flake8 fixes
2 parents 0460ab6 + 67a958f commit 8d8dbef

28 files changed

+142
-176
lines changed

ajax_select/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from django.contrib import admin
2+
23
from ajax_select.fields import autoselect_fields_check_can_add
34

45

56
class AjaxSelectAdmin(admin.ModelAdmin):
6-
77
""" in order to get + popup functions subclass this or do the same hook inside of your get_form """
88

99
def get_form(self, request, obj=None, **kwargs):

ajax_select/apps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
class AjaxSelectConfig(AppConfig):
5-
65
"""
76
Django 1.7+ enables initializing installed applications
87
and autodiscovering modules.

ajax_select/helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ def make_ajax_field(related_model, fieldname_on_model, channel, show_help_text=F
9999
kwargs['show_help_text'] = show_help_text
100100
if isinstance(field, ManyToManyField):
101101
f = AutoCompleteSelectMultipleField(
102-
channel,
103-
**kwargs)
102+
channel,
103+
**kwargs)
104104
elif isinstance(field, ForeignKey):
105105
f = AutoCompleteSelectField(
106-
channel,
107-
**kwargs)
106+
channel,
107+
**kwargs)
108108
else:
109109
f = AutoCompleteField(
110-
channel,
111-
**kwargs)
110+
channel,
111+
**kwargs)
112112
return f

ajax_select/lookup_channel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class LookupChannel(object):
7-
87
"""
98
Subclass this, setting the model and implementing methods to taste.
109

ajax_select/registry.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class LookupChannelRegistry(object):
8-
98
"""
109
Registry for LookupChannels activated for your django project.
1110
@@ -57,7 +56,7 @@ def get(self, channel):
5756
lookup_spec = self._registry[channel]
5857
except KeyError:
5958
raise ImproperlyConfigured(
60-
"No ajax_select LookupChannel named %(channel)r is registered." % {'channel': channel})
59+
"No ajax_select LookupChannel named %(channel)r is registered." % {'channel': channel})
6160

6261
if (type(lookup_spec) is type) and issubclass(lookup_spec, LookupChannel):
6362
return lookup_spec()
@@ -96,7 +95,6 @@ def make_channel(self, app_model, arg_search_field):
9695
app_label, model_name = app_model.split(".")
9796

9897
class MadeLookupChannel(LookupChannel):
99-
10098
model = get_model(app_label, model_name)
10199
search_field = arg_search_field
102100

ajax_select/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.conf.urls import url
2+
23
from ajax_select import views
34

45
urlpatterns = [

ajax_select/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import json
22
from django.http import HttpResponse
33
from django.utils.encoding import force_text
4+
45
from ajax_select import registry
56

67

78
def ajax_lookup(request, channel):
8-
99
"""Load the named lookup channel and lookup matching models.
1010
1111
GET or POST should contain 'term'

docs/source/conf.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -172,40 +172,39 @@
172172
# html_use_index = True
173173

174174
# If true, the index is split into individual pages for each letter.
175-
#html_split_index = False
175+
# html_split_index = False
176176

177177
# If true, links to the reST sources are added to the pages.
178-
#html_show_sourcelink = True
178+
# html_show_sourcelink = True
179179

180180
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
181-
#html_show_sphinx = True
181+
# html_show_sphinx = True
182182

183183
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
184-
#html_show_copyright = True
184+
# html_show_copyright = True
185185

186186
# If true, an OpenSearch description file will be output, and all pages will
187187
# contain a <link> tag referring to it. The value of this option must be the
188188
# base URL from which the finished HTML is served.
189-
#html_use_opensearch = ''
189+
# html_use_opensearch = ''
190190

191191
# This is the file name suffix for HTML files (e.g. ".xhtml").
192-
#html_file_suffix = None
192+
# html_file_suffix = None
193193

194194
# Output file base name for HTML help builder.
195195
htmlhelp_basename = 'django-ajax-selectsdoc'
196196

197-
198197
# -- Options for LaTeX output ---------------------------------------------
199198

200199
latex_elements = {
201200
# The paper size ('letterpaper' or 'a4paper').
202-
#'papersize': 'letterpaper',
201+
# 'papersize': 'letterpaper',
203202

204203
# The font size ('10pt', '11pt' or '12pt').
205-
#'pointsize': '10pt',
204+
# 'pointsize': '10pt',
206205

207206
# Additional stuff for the LaTeX preamble.
208-
#'preamble': '',
207+
# 'preamble': '',
209208
}
210209

211210
# Grouping the document tree into LaTeX files. List of tuples
@@ -218,23 +217,23 @@
218217

219218
# The name of an image file (relative to this directory) to place at the top of
220219
# the title page.
221-
#latex_logo = None
220+
# latex_logo = None
222221

223222
# For "manual" documents, if this is true, then toplevel headings are parts,
224223
# not chapters.
225-
#latex_use_parts = False
224+
# latex_use_parts = False
226225

227226
# If true, show page references after internal links.
228-
#latex_show_pagerefs = False
227+
# latex_show_pagerefs = False
229228

230229
# If true, show URL addresses after external links.
231-
#latex_show_urls = False
230+
# latex_show_urls = False
232231

233232
# Documents to append as an appendix to all manuals.
234-
#latex_appendices = []
233+
# latex_appendices = []
235234

236235
# If false, no module index is generated.
237-
#latex_domain_indices = True
236+
# latex_domain_indices = True
238237

239238

240239
# -- Options for manual page output ---------------------------------------
@@ -247,7 +246,7 @@
247246
]
248247

249248
# If true, show URL addresses after external links.
250-
#man_show_urls = False
249+
# man_show_urls = False
251250

252251

253252
# -- Options for Texinfo output -------------------------------------------
@@ -262,13 +261,13 @@
262261
]
263262

264263
# Documents to append as an appendix to all manuals.
265-
#texinfo_appendices = []
264+
# texinfo_appendices = []
266265

267266
# If false, no module index is generated.
268-
#texinfo_domain_indices = True
267+
# texinfo_domain_indices = True
269268

270269
# How to display URL addresses: 'footnote', 'no', or 'inline'.
271-
#texinfo_show_urls = 'footnote'
270+
# texinfo_show_urls = 'footnote'
272271

273272
# If true, do not generate a @detailmenu in the "Top" node's menu.
274-
#texinfo_no_detailmenu = False
273+
# texinfo_no_detailmenu = False

example/example/admin.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
21
from django.contrib import admin
3-
from ajax_select import make_ajax_form
4-
from ajax_select.admin import AjaxSelectAdmin, AjaxSelectAdminTabularInline, AjaxSelectAdminStackedInline
52
from example.forms import ReleaseForm
6-
from example.models import Person, Label, Group, Song, Release, Book, Author
3+
from example.models import Author, Book, Group, Label, Person, Release, Song
4+
5+
from ajax_select import make_ajax_form
6+
from ajax_select.admin import AjaxSelectAdmin, AjaxSelectAdminStackedInline, AjaxSelectAdminTabularInline
77

88

99
@admin.register(Person)
@@ -29,7 +29,6 @@ class PersonAdmin(YourAdminSuperclass, AjaxSelectAdmin):
2929

3030

3131
class ReleaseInline(AjaxSelectAdminStackedInline):
32-
3332
# Example of the stacked inline
3433

3534
model = Release
@@ -43,7 +42,6 @@ class ReleaseInline(AjaxSelectAdminStackedInline):
4342

4443
@admin.register(Group)
4544
class GroupAdmin(AjaxSelectAdmin):
46-
4745
# this shows a ManyToMany field
4846
form = make_ajax_form(Group, {'members': 'person'})
4947
inlines = [
@@ -53,7 +51,6 @@ class GroupAdmin(AjaxSelectAdmin):
5351

5452
@admin.register(Song)
5553
class SongAdmin(AjaxSelectAdmin):
56-
5754
form = make_ajax_form(Song, {'group': 'group', 'title': 'cliche'})
5855
# django bug:
5956
# readonly_fields = ('group',)
@@ -64,22 +61,20 @@ class SongAdmin(AjaxSelectAdmin):
6461

6562
@admin.register(Release)
6663
class ReleaseAdmin(AjaxSelectAdmin):
67-
6864
# specify a form class manually (normal django way)
6965
# see forms.py
7066
form = ReleaseForm
7167

7268

7369
class BookInline(AjaxSelectAdminTabularInline):
74-
7570
# AjaxSelectAdminTabularInline enables the + add option
7671

7772
model = Book
7873
form = make_ajax_form(Book, {
79-
'about_group': 'group',
80-
'mentions_persons': 'person'
81-
},
82-
show_help_text=True)
74+
'about_group': 'group',
75+
'mentions_persons': 'person'
76+
},
77+
show_help_text=True)
8378
extra = 2
8479

8580
# to enable the + add option
@@ -94,7 +89,6 @@ class BookInline(AjaxSelectAdminTabularInline):
9489

9590
@admin.register(Author)
9691
class AuthorAdmin(AjaxSelectAdmin):
97-
9892
inlines = [
9993
BookInline,
10094
]

example/example/forms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# -*- coding: utf-8 -*-
22

33
from __future__ import unicode_literals
4+
45
from django.forms.models import ModelForm
5-
from ajax_select import make_ajax_field
66
from example.models import Release
77

8+
from ajax_select import make_ajax_field
89

9-
class ReleaseForm(ModelForm):
1010

11+
class ReleaseForm(ModelForm):
1112
class Meta:
1213
model = Release
1314
exclude = []

0 commit comments

Comments
 (0)