Permalink
Browse files

PEP8 cleanup

Signed-off-by: Jason Myers <jason@jasonamyers.com>
  • Loading branch information...
1 parent 0fdb692 commit 7a61c68c50d3837c50e35c252fd76220f08b5290 @jasonamyers jasonamyers committed Nov 3, 2013
Showing with 739 additions and 206 deletions.
  1. +15 −0 tests/admin_changelist/models.py
  2. +2 −0 tests/admin_custom_urls/models.py
  3. +2 −0 tests/admin_docs/views.py
  4. +1 −0 tests/admin_filters/models.py
  5. +3 −0 tests/admin_inlines/admin.py
  6. +21 −0 tests/admin_inlines/models.py
  7. +13 −11 tests/admin_inlines/tests.py
  8. +4 −0 tests/admin_ordering/models.py
  9. +1 −0 tests/admin_ordering/tests.py
  10. +9 −0 tests/admin_scripts/tests.py
  11. +5 −0 tests/admin_util/models.py
  12. +3 −3 tests/admin_util/tests.py
  13. +3 −0 tests/admin_validation/tests.py
  14. +22 −0 tests/admin_views/models.py
  15. +15 −20 tests/admin_views/tests.py
  16. +1 −0 tests/admin_views/views.py
  17. +14 −0 tests/admin_widgets/models.py
  18. +15 −1 tests/admin_widgets/tests.py
  19. +3 −0 tests/aggregation/models.py
  20. +5 −1 tests/aggregation_regress/models.py
  21. +10 −8 tests/backends/tests.py
  22. +2 −0 tests/basic/models.py
  23. +32 −16 tests/basic/tests.py
  24. +2 −0 tests/bug639/models.py
  25. +5 −0 tests/bulk_create/models.py
  26. +1 −0 tests/cache/closeable_cache.py
  27. +1 −0 tests/cache/liberal_backend.py
  28. +1 −0 tests/cache/models.py
  29. +6 −0 tests/cache/tests.py
  30. +2 −0 tests/check/models.py
  31. +1 −0 tests/check/tests.py
  32. +1 −0 tests/choices/models.py
  33. +1 −0 tests/commands_sql/tests.py
  34. +1 −0 tests/conditional_processing/tests.py
  35. +4 −0 tests/conditional_processing/views.py
  36. +2 −0 tests/contenttypes_tests/models.py
  37. +1 −0 tests/contenttypes_tests/tests.py
  38. +5 −0 tests/csrf_tests/tests.py
  39. +1 −0 tests/custom_columns/models.py
  40. +1 −0 tests/custom_columns_regress/models.py
  41. +1 −0 tests/custom_columns_regress/tests.py
  42. +10 −0 tests/custom_managers/models.py
  43. +3 −0 tests/custom_managers_regress/models.py
  44. +1 −0 tests/custom_pk/fields.py
  45. +3 −1 tests/custom_pk/models.py
  46. +1 −0 tests/datatypes/models.py
  47. +2 −0 tests/dates/models.py
  48. +2 −0 tests/datetimes/models.py
  49. +1 −0 tests/db_typecasts/tests.py
  50. +1 −0 tests/defer_regress/tests.py
  51. +6 −0 tests/delete/models.py
  52. +2 −1 tests/delete/tests.py
  53. +28 −0 tests/delete_regress/models.py
  54. +2 −1 tests/delete_regress/tests.py
  55. +5 −3 tests/dispatch/tests/test_dispatcher.py
  56. +4 −0 tests/dispatch/tests/test_saferef.py
  57. +5 −0 tests/distinct_on_fields/models.py
  58. +2 −1 tests/distinct_on_fields/tests.py
  59. +1 −0 tests/expressions/models.py
  60. +1 −0 tests/expressions_regress/models.py
  61. +35 −35 tests/expressions_regress/tests.py
  62. +2 −0 tests/extra_regress/models.py
  63. +2 −0 tests/field_subclassing/fields.py
  64. +2 −0 tests/field_subclassing/models.py
  65. +1 −0 tests/file_storage/models.py
  66. +5 −0 tests/file_storage/tests.py
  67. +2 −1 tests/file_uploads/tests.py
  68. +3 −1 tests/file_uploads/uploadhandler.py
  69. +10 −0 tests/file_uploads/views.py
  70. +8 −0 tests/fixtures/models.py
  71. +1 −0 tests/fixtures_model_package/models/__init__.py
  72. +1 −0 tests/fixtures_regress/models.py
  73. +4 −0 tests/force_insert_update/models.py
  74. +11 −0 tests/foreign_object/models.py
  75. +2 −0 tests/foreign_object/tests.py
  76. +4 −1 tests/forms_tests/models.py
  77. +1 −0 tests/forms_tests/tests/test_error_messages.py
  78. +3 −0 tests/forms_tests/tests/test_extra.py
  79. +5 −1 tests/forms_tests/tests/test_formsets.py
  80. +2 −0 tests/forms_tests/tests/test_input_formats.py
  81. +3 −1 tests/forms_tests/tests/test_widgets.py
  82. +1 −0 tests/forms_tests/tests/tests.py
  83. +1 −0 tests/generic_inline_admin/admin.py
  84. +2 −0 tests/generic_inline_admin/models.py
  85. +3 −0 tests/generic_inline_admin/tests.py
  86. +2 −0 tests/generic_relations/tests.py
  87. +25 −0 tests/generic_relations_regress/models.py
  88. +4 −0 tests/generic_views/models.py
  89. +1 −0 tests/generic_views/test_base.py
  90. +2 −1 tests/generic_views/test_dates.py
  91. +19 −0 tests/generic_views/views.py
  92. +2 −0 tests/get_object_or_404/models.py
  93. +2 −0 tests/get_or_create_regress/models.py
  94. +5 −0 tests/handlers/views.py
  95. +5 −0 tests/httpwrappers/tests.py
  96. +2 −0 tests/i18n/forms.py
  97. +1 −0 tests/i18n/models.py
  98. +12 −6 tests/i18n/test_extraction.py
  99. +3 −0 tests/i18n/tests.py
  100. +4 −0 tests/inline_formsets/models.py
  101. +6 −0 tests/inspectdb/models.py
  102. +2 −1 tests/inspectdb/tests.py
  103. +4 −0 tests/known_related_objects/models.py
  104. +1 −0 tests/known_related_objects/tests.py
  105. +2 −0 tests/logging_tests/tests.py
  106. +5 −0 tests/lookup/models.py
  107. +2 −0 tests/m2m_and_m2o/models.py
  108. +2 −1 tests/m2m_and_m2o/tests.py
  109. +2 −0 tests/m2m_intermediary/models.py
  110. +9 −0 tests/m2m_regress/models.py
  111. +3 −0 tests/m2m_signals/models.py
  112. +6 −0 tests/m2m_through/models.py
  113. +9 −0 tests/m2m_through_regress/models.py
  114. +1 −0 tests/m2o_recursive/models.py
  115. +1 −0 tests/m2o_recursive/tests.py
  116. +1 −0 tests/many_to_many/models.py
  117. +1 −0 tests/many_to_one/models.py
  118. +1 −0 tests/many_to_one_null/models.py
  119. +10 −1 tests/many_to_one_regress/models.py
  120. +1 −0 tests/max_lengths/models.py
  121. +1 −0 tests/max_lengths/tests.py
  122. +7 −5 tests/middleware/tests.py
  123. +2 −0 tests/middleware_exceptions/tests.py
  124. +6 −0 tests/middleware_exceptions/views.py
  125. +8 −0 tests/model_fields/tests.py
  126. +28 −0 tests/model_forms/models.py
  127. +1 −0 tests/model_inheritance_same_model_name/models.py
  128. +96 −84 tests/multiple_database/tests.py
@@ -1,33 +1,40 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+
class Event(models.Model):
# Oracle can have problems with a column named "date"
date = models.DateField(db_column="event_date")
+
class Parent(models.Model):
name = models.CharField(max_length=128)
+
class Child(models.Model):
parent = models.ForeignKey(Parent, editable=False, null=True)
name = models.CharField(max_length=30, blank=True)
age = models.IntegerField(null=True, blank=True)
+
class Genre(models.Model):
name = models.CharField(max_length=20)
+
class Band(models.Model):
name = models.CharField(max_length=20)
nr_of_members = models.PositiveIntegerField()
genres = models.ManyToManyField(Genre)
+
@python_2_unicode_compatible
class Musician(models.Model):
name = models.CharField(max_length=30)
def __str__(self):
return self.name
+
@python_2_unicode_compatible
class Group(models.Model):
name = models.CharField(max_length=30)
@@ -36,26 +43,32 @@ class Group(models.Model):
def __str__(self):
return self.name
+
class Membership(models.Model):
music = models.ForeignKey(Musician)
group = models.ForeignKey(Group)
role = models.CharField(max_length=15)
+
class Quartet(Group):
pass
+
class ChordsMusician(Musician):
pass
+
class ChordsBand(models.Model):
name = models.CharField(max_length=30)
members = models.ManyToManyField(ChordsMusician, through='Invitation')
+
class Invitation(models.Model):
player = models.ForeignKey(ChordsMusician)
band = models.ForeignKey(ChordsBand)
instrument = models.CharField(max_length=15)
+
class Swallow(models.Model):
origin = models.CharField(max_length=255)
load = models.FloatField()
@@ -77,6 +90,7 @@ class OrderedObjectManager(models.Manager):
def get_queryset(self):
return super(OrderedObjectManager, self).get_queryset().order_by('number')
+
class OrderedObject(models.Model):
"""
Model with Manager that defines a default order.
@@ -88,5 +102,6 @@ class OrderedObject(models.Model):
objects = OrderedObjectManager()
+
class CustomIdUser(models.Model):
uuid = models.AutoField(primary_key=True)
@@ -54,6 +54,7 @@ def wrapper(*args, **kwargs):
class Person(models.Model):
name = models.CharField(max_length=20)
+
class PersonAdmin(admin.ModelAdmin):
def response_post_save_add(self, request, obj):
@@ -68,6 +69,7 @@ def response_post_save_change(self, request, obj):
class Car(models.Model):
name = models.CharField(max_length=20)
+
class CarAdmin(admin.ModelAdmin):
def response_add(self, request, obj, post_url_continue=None):
@@ -5,9 +5,11 @@
xview_dec = decorator_from_middleware(XViewMiddleware)
+
def xview(request):
return HttpResponse()
+
class XViewClass(View):
def get(self, request):
return HttpResponse()
@@ -27,6 +27,7 @@ class Department(models.Model):
def __str__(self):
return self.description
+
@python_2_unicode_compatible
class Employee(models.Model):
department = models.ForeignKey(Department, to_field="code")
@@ -153,6 +153,7 @@ class ChildModel1Inline(admin.TabularInline):
class ChildModel2Inline(admin.StackedInline):
model = ChildModel2
+
# admin for #19425 and #18388
class BinaryTreeAdmin(admin.TabularInline):
model = BinaryTree
@@ -169,10 +170,12 @@ def get_max_num(self, request, obj=None, **kwargs):
return max_num - obj.binarytree_set.count()
return max_num
+
# admin for #19524
class SightingInline(admin.TabularInline):
model = Sighting
+
# admin and form for #18263
class SomeChildModelForm(forms.ModelForm):
@@ -89,6 +89,7 @@ class Inner2(models.Model):
dummy = models.IntegerField()
holder = models.ForeignKey(Holder2)
+
class Holder3(models.Model):
dummy = models.IntegerField()
@@ -99,58 +100,72 @@ class Inner3(models.Model):
# Models for ticket #8190
+
class Holder4(models.Model):
dummy = models.IntegerField()
+
class Inner4Stacked(models.Model):
dummy = models.IntegerField(help_text="Awesome stacked help text is awesome.")
holder = models.ForeignKey(Holder4)
+
class Inner4Tabular(models.Model):
dummy = models.IntegerField(help_text="Awesome tabular help text is awesome.")
holder = models.ForeignKey(Holder4)
# Models for #12749
+
class Person(models.Model):
firstname = models.CharField(max_length=15)
+
class OutfitItem(models.Model):
name = models.CharField(max_length=15)
+
class Fashionista(models.Model):
person = models.OneToOneField(Person, primary_key=True)
weaknesses = models.ManyToManyField(OutfitItem, through='ShoppingWeakness', blank=True)
+
class ShoppingWeakness(models.Model):
fashionista = models.ForeignKey(Fashionista)
item = models.ForeignKey(OutfitItem)
# Models for #13510
+
class TitleCollection(models.Model):
pass
+
class Title(models.Model):
collection = models.ForeignKey(TitleCollection, blank=True, null=True)
title1 = models.CharField(max_length=100)
title2 = models.CharField(max_length=100)
# Models for #15424
+
class Poll(models.Model):
name = models.CharField(max_length=40)
+
class Question(models.Model):
poll = models.ForeignKey(Poll)
+
class Novel(models.Model):
name = models.CharField(max_length=40)
+
class Chapter(models.Model):
name = models.CharField(max_length=40)
novel = models.ForeignKey(Novel)
+
class FootNote(models.Model):
"""
Model added for ticket 19838
@@ -160,6 +175,7 @@ class FootNote(models.Model):
# Models for #16838
+
class CapoFamiglia(models.Model):
name = models.CharField(max_length=100)
@@ -211,12 +227,15 @@ class BinaryTree(models.Model):
# Models for #19524
+
class LifeForm(models.Model):
pass
+
class ExtraTerrestrial(LifeForm):
name = models.CharField(max_length=100)
+
class Sighting(models.Model):
et = models.ForeignKey(ExtraTerrestrial)
place = models.CharField(max_length=100)
@@ -234,9 +253,11 @@ class SomeChildModel(models.Model):
# Other models
+
class ProfileCollection(models.Model):
pass
+
class Profile(models.Model):
collection = models.ForeignKey(ProfileCollection, blank=True, null=True)
first_name = models.CharField(max_length=100)
@@ -279,6 +279,7 @@ def test_all_inline_media(self):
self.assertContains(response, 'my_awesome_admin_scripts.js')
self.assertContains(response, 'my_awesome_inline_scripts.js')
+
class TestInlineAdminForm(TestCase):
urls = "admin_inlines.urls"
@@ -465,9 +466,9 @@ def test_inline_change_fk_add_perm(self):
self.assertContains(response, 'Add another Inner2')
# 3 extra forms only, not the existing instance form
self.assertContains(response, '<input type="hidden" id="id_inner2_set-TOTAL_FORMS" '
- 'value="3" name="inner2_set-TOTAL_FORMS" />', html=True)
+ 'value="3" name="inner2_set-TOTAL_FORMS" />', html=True)
self.assertNotContains(response, '<input type="hidden" id="id_inner2_set-0-id" '
- 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
+ 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
def test_inline_change_fk_change_perm(self):
permission = Permission.objects.get(codename='change_inner2', content_type=self.inner_ct)
@@ -477,12 +478,12 @@ def test_inline_change_fk_change_perm(self):
self.assertContains(response, '<h2>Inner2s</h2>')
# Just the one form for existing instances
self.assertContains(response, '<input type="hidden" id="id_inner2_set-TOTAL_FORMS" '
- 'value="1" name="inner2_set-TOTAL_FORMS" />', html=True)
+ 'value="1" name="inner2_set-TOTAL_FORMS" />', html=True)
self.assertContains(response, '<input type="hidden" id="id_inner2_set-0-id" '
- 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
+ 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
# max-num 0 means we can't add new ones
self.assertContains(response, '<input type="hidden" id="id_inner2_set-MAX_NUM_FORMS" '
- 'value="0" name="inner2_set-MAX_NUM_FORMS" />', html=True)
+ 'value="0" name="inner2_set-MAX_NUM_FORMS" />', html=True)
def test_inline_change_fk_add_change_perm(self):
permission = Permission.objects.get(codename='add_inner2', content_type=self.inner_ct)
@@ -494,9 +495,9 @@ def test_inline_change_fk_add_change_perm(self):
self.assertContains(response, '<h2>Inner2s</h2>')
# One form for existing instance and three extra for new
self.assertContains(response, '<input type="hidden" id="id_inner2_set-TOTAL_FORMS" '
- 'value="4" name="inner2_set-TOTAL_FORMS" />', html=True)
+ 'value="4" name="inner2_set-TOTAL_FORMS" />', html=True)
self.assertContains(response, '<input type="hidden" id="id_inner2_set-0-id" '
- 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
+ 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
def test_inline_change_fk_change_del_perm(self):
permission = Permission.objects.get(codename='change_inner2', content_type=self.inner_ct)
@@ -508,9 +509,9 @@ def test_inline_change_fk_change_del_perm(self):
self.assertContains(response, '<h2>Inner2s</h2>')
# One form for existing instance only, no new
self.assertContains(response, '<input type="hidden" id="id_inner2_set-TOTAL_FORMS" '
- 'value="1" name="inner2_set-TOTAL_FORMS" />', html=True)
+ 'value="1" name="inner2_set-TOTAL_FORMS" />', html=True)
self.assertContains(response, '<input type="hidden" id="id_inner2_set-0-id" '
- 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
+ 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')
def test_inline_change_fk_all_perms(self):
@@ -525,9 +526,9 @@ def test_inline_change_fk_all_perms(self):
self.assertContains(response, '<h2>Inner2s</h2>')
# One form for existing instance only, three for new
self.assertContains(response, '<input type="hidden" id="id_inner2_set-TOTAL_FORMS" '
- 'value="4" name="inner2_set-TOTAL_FORMS" />', html=True)
+ 'value="4" name="inner2_set-TOTAL_FORMS" />', html=True)
self.assertContains(response, '<input type="hidden" id="id_inner2_set-0-id" '
- 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
+ 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')
@@ -698,5 +699,6 @@ def test_alternating_rows(self):
class SeleniumChromeTests(SeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
+
class SeleniumIETests(SeleniumFirefoxTests):
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
@@ -11,6 +11,7 @@ class Band(models.Model):
class Meta:
ordering = ('name',)
+
class Song(models.Model):
band = models.ForeignKey(Band)
name = models.CharField(max_length=100)
@@ -20,13 +21,16 @@ class Song(models.Model):
class Meta:
ordering = ('name',)
+
class SongInlineDefaultOrdering(admin.StackedInline):
model = Song
+
class SongInlineNewOrdering(admin.StackedInline):
model = Song
ordering = ('duration', )
+
class DynOrderingBandAdmin(admin.ModelAdmin):
def get_ordering(self, request):
@@ -12,6 +12,7 @@
class MockRequest(object):
pass
+
class MockSuperUser(object):
def has_perm(self, perm):
return True
Oops, something went wrong.

0 comments on commit 7a61c68

Please sign in to comment.