Browse Source

fix #707: isort imports after cleanup

Rafał Pitoń 8 years ago
parent
commit
0f2c443f6f
234 changed files with 310 additions and 468 deletions
  1. 9 4
      .isort.cfg
  2. 1 2
      misago/acl/migrations/0002_acl_version_tracker.py
  3. 1 2
      misago/acl/tests/test_api.py
  4. 1 2
      misago/acl/tests/test_providers.py
  5. 1 2
      misago/acl/tests/test_roleadmin_views.py
  6. 1 2
      misago/admin/views/auth.py
  7. 2 1
      misago/admin/views/errorpages.py
  8. 1 1
      misago/admin/views/generic/list.py
  9. 1 0
      misago/admin/views/index.py
  10. 3 14
      misago/categories/admin.py
  11. 1 2
      misago/categories/management/commands/synchronizecategories.py
  12. 1 1
      misago/categories/migrations/0001_initial.py
  13. 2 2
      misago/categories/serializers.py
  14. 1 2
      misago/categories/tests/test_categories_admin_views.py
  15. 2 3
      misago/categories/tests/test_category_model.py
  16. 0 1
      misago/categories/tests/test_permissions_admin_views.py
  17. 1 2
      misago/categories/tests/test_prunecategories.py
  18. 1 2
      misago/categories/tests/test_synchronizecategories.py
  19. 2 3
      misago/categories/tests/test_utils.py
  20. 1 2
      misago/categories/tests/test_views.py
  21. 1 2
      misago/categories/urls/api.py
  22. 1 2
      misago/categories/views/categoriesadmin.py
  23. 3 2
      misago/categories/views/permsadmin.py
  24. 2 1
      misago/conf/context_processors.py
  25. 2 1
      misago/conf/forms.py
  26. 0 1
      misago/conf/tests/test_admin_views.py
  27. 1 2
      misago/conf/tests/test_context_processors.py
  28. 1 2
      misago/conf/tests/test_migrationutils.py
  29. 2 3
      misago/conf/tests/test_settings.py
  30. 2 2
      misago/core/apipatch.py
  31. 2 2
      misago/core/exceptionhandler.py
  32. 1 2
      misago/core/forms.py
  33. 0 1
      misago/core/momentjs.py
  34. 2 2
      misago/core/rest_permissions.py
  35. 2 2
      misago/core/shortcuts.py
  36. 1 0
      misago/core/templatetags/misago_json.py
  37. 1 1
      misago/core/testproject/urls.py
  38. 4 4
      misago/core/testproject/views.py
  39. 1 2
      misago/core/tests/test_errorpages.py
  40. 1 2
      misago/core/tests/test_exceptionhandler_middleware.py
  41. 1 2
      misago/core/tests/test_exceptionhandlers.py
  42. 1 1
      misago/core/tests/test_momentjs.py
  43. 3 8
      misago/core/tests/test_utils.py
  44. 2 2
      misago/datamover/attachments.py
  45. 1 1
      misago/datamover/avatars.py
  46. 1 2
      misago/datamover/management/commands/buildmovesindex.py
  47. 1 1
      misago/datamover/management/commands/movesettings.py
  48. 1 2
      misago/datamover/markup/attachments.py
  49. 2 2
      misago/datamover/polls.py
  50. 2 3
      misago/datamover/threads.py
  51. 1 1
      misago/datamover/users.py
  52. 1 2
      misago/datamover/views.py
  53. 1 1
      misago/faker/englishcorpus.py
  54. 1 2
      misago/faker/management/commands/createfakethreads.py
  55. 4 4
      misago/markup/api.py
  56. 1 1
      misago/markup/parser.py
  57. 1 2
      misago/markup/tests/test_mentions.py
  58. 1 0
      misago/project_template/manage.py
  59. 1 0
      misago/project_template/project_name/settings.py
  60. 1 0
      misago/project_template/project_name/wsgi.py
  61. 1 2
      misago/readtracker/tests/test_readtracker.py
  62. 4 4
      misago/search/api.py
  63. 1 2
      misago/search/tests/test_api.py
  64. 0 1
      misago/search/tests/test_searchproviders.py
  65. 1 5
      misago/threads/admin.py
  66. 3 4
      misago/threads/api/attachments.py
  67. 2 3
      misago/threads/api/pollvotecreateendpoint.py
  68. 3 4
      misago/threads/api/postendpoints/edits.py
  69. 2 3
      misago/threads/api/postendpoints/merge.py
  70. 4 4
      misago/threads/api/postendpoints/move.py
  71. 0 1
      misago/threads/api/postendpoints/patch_event.py
  72. 0 1
      misago/threads/api/postendpoints/patch_post.py
  73. 3 4
      misago/threads/api/postendpoints/split.py
  74. 3 3
      misago/threads/api/postingendpoint/attachments.py
  75. 4 4
      misago/threads/api/postingendpoint/category.py
  76. 2 1
      misago/threads/api/postingendpoint/close.py
  77. 1 1
      misago/threads/api/postingendpoint/emailnotification.py
  78. 2 1
      misago/threads/api/postingendpoint/hide.py
  79. 4 4
      misago/threads/api/postingendpoint/participants.py
  80. 2 1
      misago/threads/api/postingendpoint/pin.py
  81. 4 4
      misago/threads/api/postingendpoint/reply.py
  82. 2 1
      misago/threads/api/postingendpoint/subscribe.py
  83. 1 1
      misago/threads/api/postingendpoint/syncprivatethreads.py
  84. 2 3
      misago/threads/api/threadendpoints/editor.py
  85. 2 2
      misago/threads/api/threadendpoints/list.py
  86. 3 3
      misago/threads/api/threadendpoints/merge.py
  87. 1 3
      misago/threads/api/threadendpoints/patch.py
  88. 0 1
      misago/threads/api/threadendpoints/read.py
  89. 6 11
      misago/threads/api/threadpoll.py
  90. 8 7
      misago/threads/api/threadposts.py
  91. 5 5
      misago/threads/api/threads.py
  92. 0 1
      misago/threads/management/commands/clearattachments.py
  93. 0 1
      misago/threads/management/commands/rebuildpostssearch.py
  94. 0 1
      misago/threads/management/commands/synchronizethreads.py
  95. 1 1
      misago/threads/migrations/0004_update_settings.py
  96. 0 1
      misago/threads/models/post.py
  97. 0 1
      misago/threads/permissions/attachments.py
  98. 0 1
      misago/threads/permissions/polls.py
  99. 0 1
      misago/threads/permissions/privatethreads.py
  100. 0 1
      misago/threads/permissions/threads.py
  101. 1 1
      misago/threads/search.py
  102. 2 3
      misago/threads/serializers/attachment.py
  103. 2 3
      misago/threads/serializers/moderation.py
  104. 2 2
      misago/threads/serializers/poll.py
  105. 2 2
      misago/threads/serializers/pollvote.py
  106. 3 4
      misago/threads/serializers/post.py
  107. 2 2
      misago/threads/serializers/postedit.py
  108. 2 2
      misago/threads/serializers/postlike.py
  109. 3 3
      misago/threads/serializers/thread.py
  110. 1 2
      misago/threads/signals.py
  111. 0 1
      misago/threads/tests/test_attachmentadmin_views.py
  112. 1 2
      misago/threads/tests/test_attachments_api.py
  113. 3 3
      misago/threads/tests/test_attachments_middleware.py
  114. 0 1
      misago/threads/tests/test_attachmenttypeadmin_views.py
  115. 1 2
      misago/threads/tests/test_attachmentview.py
  116. 0 1
      misago/threads/tests/test_clearattachments.py
  117. 1 2
      misago/threads/tests/test_emailnotification_middleware.py
  118. 0 1
      misago/threads/tests/test_events.py
  119. 1 2
      misago/threads/tests/test_floodprotection.py
  120. 3 3
      misago/threads/tests/test_floodprotection_middleware.py
  121. 1 2
      misago/threads/tests/test_gotoviews.py
  122. 1 6
      misago/threads/tests/test_participants.py
  123. 1 2
      misago/threads/tests/test_post_mentions.py
  124. 0 1
      misago/threads/tests/test_post_model.py
  125. 1 2
      misago/threads/tests/test_posts_moderation.py
  126. 1 1
      misago/threads/tests/test_privatethread_patch_api.py
  127. 1 1
      misago/threads/tests/test_privatethread_reply_api.py
  128. 1 2
      misago/threads/tests/test_privatethread_start_api.py
  129. 1 1
      misago/threads/tests/test_privatethread_view.py
  130. 1 1
      misago/threads/tests/test_privatethreads_api.py
  131. 1 1
      misago/threads/tests/test_privatethreads_lists.py
  132. 1 2
      misago/threads/tests/test_search.py
  133. 1 2
      misago/threads/tests/test_subscription_middleware.py
  134. 1 2
      misago/threads/tests/test_subscriptions.py
  135. 1 0
      misago/threads/tests/test_sync_unread_private_threads.py
  136. 0 1
      misago/threads/tests/test_synchronizethreads.py
  137. 1 2
      misago/threads/tests/test_thread_editreply_api.py
  138. 1 1
      misago/threads/tests/test_thread_merge_api.py
  139. 0 1
      misago/threads/tests/test_thread_model.py
  140. 1 1
      misago/threads/tests/test_thread_patch_api.py
  141. 1 2
      misago/threads/tests/test_thread_poll_api.py
  142. 1 0
      misago/threads/tests/test_thread_pollcreate_api.py
  143. 1 0
      misago/threads/tests/test_thread_polldelete_api.py
  144. 1 0
      misago/threads/tests/test_thread_polledit_api.py
  145. 1 0
      misago/threads/tests/test_thread_pollvotes_api.py
  146. 1 0
      misago/threads/tests/test_thread_postdelete_api.py
  147. 1 1
      misago/threads/tests/test_thread_postedits_api.py
  148. 1 0
      misago/threads/tests/test_thread_postlikes_api.py
  149. 1 2
      misago/threads/tests/test_thread_postmerge_api.py
  150. 1 2
      misago/threads/tests/test_thread_postmove_api.py
  151. 1 2
      misago/threads/tests/test_thread_postpatch_api.py
  152. 1 1
      misago/threads/tests/test_thread_postread_api.py
  153. 1 2
      misago/threads/tests/test_thread_postsplit_api.py
  154. 1 2
      misago/threads/tests/test_thread_reply_api.py
  155. 1 2
      misago/threads/tests/test_thread_start_api.py
  156. 0 1
      misago/threads/tests/test_threadparticipant_model.py
  157. 1 2
      misago/threads/tests/test_threads_api.py
  158. 1 2
      misago/threads/tests/test_threads_editor_api.py
  159. 1 1
      misago/threads/tests/test_threads_merge_api.py
  160. 1 2
      misago/threads/tests/test_threads_moderation.py
  161. 1 2
      misago/threads/tests/test_threadslists.py
  162. 1 2
      misago/threads/tests/test_threadview.py
  163. 0 1
      misago/threads/tests/test_treesmap.py
  164. 0 1
      misago/threads/tests/test_utils.py
  165. 0 1
      misago/threads/tests/test_validators.py
  166. 0 1
      misago/threads/urls/api.py
  167. 0 1
      misago/threads/viewmodels/category.py
  168. 0 1
      misago/threads/viewmodels/post.py
  169. 1 2
      misago/threads/viewmodels/posts.py
  170. 2 2
      misago/threads/viewmodels/thread.py
  171. 0 1
      misago/threads/viewmodels/threads.py
  172. 0 1
      misago/threads/views/admin/attachments.py
  173. 0 1
      misago/threads/views/admin/attachmenttypes.py
  174. 0 1
      misago/threads/views/attachment.py
  175. 0 1
      misago/threads/views/goto.py
  176. 2 2
      misago/threads/views/list.py
  177. 2 3
      misago/users/admin.py
  178. 7 6
      misago/users/api/auth.py
  179. 2 2
      misago/users/api/captcha.py
  180. 2 3
      misago/users/api/rest_permissions.py
  181. 3 4
      misago/users/api/userendpoints/avatar.py
  182. 2 3
      misago/users/api/userendpoints/changeemail.py
  183. 2 3
      misago/users/api/userendpoints/changepassword.py
  184. 3 4
      misago/users/api/userendpoints/create.py
  185. 3 5
      misago/users/api/userendpoints/list.py
  186. 3 4
      misago/users/api/userendpoints/signature.py
  187. 3 4
      misago/users/api/userendpoints/username.py
  188. 5 6
      misago/users/api/usernamechanges.py
  189. 8 7
      misago/users/api/users.py
  190. 0 1
      misago/users/forms/admin.py
  191. 0 1
      misago/users/forms/moderation.py
  192. 0 1
      misago/users/forms/options.py
  193. 0 1
      misago/users/management/commands/buildactivepostersranking.py
  194. 0 1
      misago/users/management/commands/invalidatebans.py
  195. 0 1
      misago/users/management/commands/loadavatargallery.py
  196. 2 2
      misago/users/middleware.py
  197. 3 3
      misago/users/migrations/0001_initial.py
  198. 0 1
      misago/users/migrations/0003_bans_version_tracker.py
  199. 1 1
      misago/users/migrations/0006_update_settings.py
  200. 0 1
      misago/users/models/ban.py
  201. 2 2
      misago/users/models/user.py
  202. 0 1
      misago/users/permissions/moderation.py
  203. 2 1
      misago/users/search.py
  204. 2 3
      misago/users/serializers/ban.py
  205. 0 1
      misago/users/serializers/rank.py
  206. 2 2
      misago/users/serializers/user.py
  207. 1 0
      misago/users/serializers/usernamechange.py
  208. 0 1
      misago/users/templatetags/misago_avatars.py
  209. 0 1
      misago/users/tests/test_activation_views.py
  210. 2 2
      misago/users/tests/test_activepostersranking.py
  211. 1 3
      misago/users/tests/test_avatars.py
  212. 0 1
      misago/users/tests/test_banadmin_views.py
  213. 1 2
      misago/users/tests/test_bans.py
  214. 0 1
      misago/users/tests/test_decorators.py
  215. 0 1
      misago/users/tests/test_forgottenpassword_views.py
  216. 0 1
      misago/users/tests/test_lists_views.py
  217. 0 1
      misago/users/tests/test_profile_views.py
  218. 0 1
      misago/users/tests/test_rankadmin_views.py
  219. 0 1
      misago/users/tests/test_user_avatar_api.py
  220. 0 1
      misago/users/tests/test_user_create_api.py
  221. 0 1
      misago/users/tests/test_user_signature_api.py
  222. 0 1
      misago/users/tests/test_user_username_api.py
  223. 0 1
      misago/users/tests/test_useradmin_views.py
  224. 0 1
      misago/users/tests/test_usernamechanges_api.py
  225. 0 1
      misago/users/tests/test_users_api.py
  226. 3 11
      misago/users/tests/test_validators.py
  227. 0 1
      misago/users/urls/api.py
  228. 0 1
      misago/users/views/activation.py
  229. 0 1
      misago/users/views/admin/bans.py
  230. 0 1
      misago/users/views/admin/ranks.py
  231. 1 3
      misago/users/views/admin/users.py
  232. 0 1
      misago/users/views/forgottenpassword.py
  233. 1 3
      misago/users/views/lists.py
  234. 0 1
      misago/users/views/profile.py

+ 9 - 4
.isort.cfg

@@ -1,9 +1,14 @@
 [settings]
 [settings]
-line_length=120
+line_length=100
 lines_after_imports=2
 lines_after_imports=2
+known_crispyforms=crispy_forms
 known_django=django
 known_django=django
-known_first_party=misago
+known_faker=faker
+kmown_mptt=mptt
+knowm_requests=requests
 known_restframework=rest_framework
 known_restframework=rest_framework
-sections=FUTURE,STDLIB,THIRDPARTY,DJANGO,RESTFRAMEWORK,FIRSTPARTY,LOCALFOLDER
-multi_line_output=3
+known_unidecode=unidecode
+known_first_party=misago
+sections=FUTURE,STDLIB,THIRDPARTY,CRISPYFORMS,FAKER,MPTT,REQUESTS,RESTFRAMEWORK,UNIDECODE,DJANGO,FIRSTPARTY,LOCALFOLDER
+multi_line_output=4
 verbose=true
 verbose=true

+ 1 - 2
misago/acl/migrations/0002_acl_version_tracker.py

@@ -4,9 +4,8 @@ from __future__ import unicode_literals
 
 
 from django.db import migrations, models
 from django.db import migrations, models
 
 
-from misago.core.migrationutils import cachebuster_register_cache
-
 from misago.acl.constants import ACL_CACHEBUSTER
 from misago.acl.constants import ACL_CACHEBUSTER
+from misago.core.migrationutils import cachebuster_register_cache
 
 
 
 
 def register_acl_version_tracker(apps, schema_editor):
 def register_acl_version_tracker(apps, schema_editor):

+ 1 - 2
misago/acl/tests/test_api.py

@@ -1,9 +1,8 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.test import TestCase
 from django.test import TestCase
 
 
-from misago.users.models import AnonymousUser
-
 from misago.acl.api import get_user_acl
 from misago.acl.api import get_user_acl
+from misago.users.models import AnonymousUser
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 2
misago/acl/tests/test_providers.py

@@ -4,9 +4,8 @@ from types import ModuleType
 from django.test import TestCase
 from django.test import TestCase
 from django.utils import six
 from django.utils import six
 
 
-from misago.conf import settings
-
 from misago.acl.providers import PermissionProviders
 from misago.acl.providers import PermissionProviders
+from misago.conf import settings
 
 
 
 
 class TestType(object):
 class TestType(object):

+ 1 - 2
misago/acl/tests/test_roleadmin_views.py

@@ -1,9 +1,8 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
-from misago.admin.testutils import AdminTestCase
-
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.acl.testutils import fake_post_data
 from misago.acl.testutils import fake_post_data
+from misago.admin.testutils import AdminTestCase
 
 
 
 
 def fake_data(data_dict):
 def fake_data(data_dict):

+ 1 - 2
misago/admin/views/auth.py

@@ -5,9 +5,8 @@ from django.views.decorators.cache import never_cache
 from django.views.decorators.csrf import csrf_protect
 from django.views.decorators.csrf import csrf_protect
 from django.views.decorators.debug import sensitive_post_parameters
 from django.views.decorators.debug import sensitive_post_parameters
 
 
-from misago.users.forms.auth import AdminAuthenticationForm
-
 from misago.admin import auth
 from misago.admin import auth
+from misago.users.forms.auth import AdminAuthenticationForm
 
 
 
 
 @sensitive_post_parameters()
 @sensitive_post_parameters()

+ 2 - 1
misago/admin/views/errorpages.py

@@ -1,8 +1,9 @@
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 
 
-from . import get_protected_namespace, protected_admin_view, render
 from misago.admin.auth import is_admin_session, update_admin_session
 from misago.admin.auth import is_admin_session, update_admin_session
 
 
+from . import get_protected_namespace, protected_admin_view, render
+
 
 
 # Magic error page used by admin
 # Magic error page used by admin
 @protected_admin_view
 @protected_admin_view

+ 1 - 1
misago/admin/views/generic/list.py

@@ -3,8 +3,8 @@ from django.core.paginator import EmptyPage, Paginator
 from django.db import transaction
 from django.db import transaction
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 from django.urls import reverse
 from django.urls import reverse
-from django.utils.translation import ugettext_lazy as _
 from django.utils.six.moves.urllib.parse import urlencode
 from django.utils.six.moves.urllib.parse import urlencode
+from django.utils.translation import ugettext_lazy as _
 
 
 from misago.core.exceptions import ExplicitFirstPage
 from misago.core.exceptions import ExplicitFirstPage
 
 

+ 1 - 0
misago/admin/views/index.py

@@ -14,6 +14,7 @@ from misago.threads.models import Post, Thread
 
 
 from . import render
 from . import render
 
 
+
 VERSION_CHECK_CACHE_KEY = "misago_version_check"
 VERSION_CHECK_CACHE_KEY = "misago_version_check"
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 3 - 14
misago/categories/admin.py

@@ -2,21 +2,10 @@ from django.conf.urls import url
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from .views.categoriesadmin import (
 from .views.categoriesadmin import (
-    CategoriesList,
-    DeleteCategory,
-    EditCategory,
-    MoveDownCategory,
-    MoveUpCategory,
-    NewCategory
-)
+    CategoriesList, DeleteCategory, EditCategory, MoveDownCategory, MoveUpCategory, NewCategory)
 from .views.permsadmin import (
 from .views.permsadmin import (
-    CategoryPermissions,
-    CategoryRolesList,
-    DeleteCategoryRole,
-    EditCategoryRole,
-    NewCategoryRole,
-    RoleCategoriesACL
-)
+    CategoryPermissions, CategoryRolesList, DeleteCategoryRole, EditCategoryRole, NewCategoryRole,
+    RoleCategoriesACL)
 
 
 
 
 class MisagoAdminExtension(object):
 class MisagoAdminExtension(object):

+ 1 - 2
misago/categories/management/commands/synchronizecategories.py

@@ -1,8 +1,7 @@
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
 
 
-from misago.core.management.progressbar import show_progress
-
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.core.management.progressbar import show_progress
 
 
 
 
 class Command(BaseCommand):
 class Command(BaseCommand):

+ 1 - 1
misago/categories/migrations/0001_initial.py

@@ -3,9 +3,9 @@ from __future__ import unicode_literals
 
 
 import mptt.fields
 import mptt.fields
 
 
+import django.db.models.deletion
 from django.conf import settings
 from django.conf import settings
 from django.contrib.postgres.fields import JSONField
 from django.contrib.postgres.fields import JSONField
-import django.db.models.deletion
 from django.db import migrations, models
 from django.db import migrations, models
 
 
 from misago.acl.models import permissions_default
 from misago.acl.models import permissions_default

+ 2 - 2
misago/categories/serializers.py

@@ -1,7 +1,7 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
+from django.urls import reverse
+
 from misago.core.utils import format_plaintext_for_html
 from misago.core.utils import format_plaintext_for_html
 
 
 from .models import Category
 from .models import Category

+ 1 - 2
misago/categories/tests/test_categories_admin_views.py

@@ -1,11 +1,10 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
+from misago.categories.models import Category
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 
 
-from misago.categories.models import Category
-
 
 
 class CategoryAdminTestCate(AdminTestCase):
 class CategoryAdminTestCate(AdminTestCase):
     def assertValidTree(self, expected_tree):
     def assertValidTree(self, expected_tree):

+ 2 - 3
misago/categories/tests/test_category_model.py

@@ -1,12 +1,11 @@
 from django.utils import timezone
 from django.utils import timezone
 
 
+from misago.categories import THREADS_ROOT_NAME
+from misago.categories.models import Category
 from misago.core.testutils import MisagoTestCase
 from misago.core.testutils import MisagoTestCase
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
 
 
-from misago.categories import THREADS_ROOT_NAME
-from misago.categories.models import Category
-
 
 
 class CategoryManagerTests(MisagoTestCase):
 class CategoryManagerTests(MisagoTestCase):
     def test_private_threads(self):
     def test_private_threads(self):

+ 0 - 1
misago/categories/tests/test_permissions_admin_views.py

@@ -3,7 +3,6 @@ from django.urls import reverse
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.acl.testutils import fake_post_data
 from misago.acl.testutils import fake_post_data
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
-
 from misago.categories.models import Category, CategoryRole
 from misago.categories.models import Category, CategoryRole
 
 
 
 

+ 1 - 2
misago/categories/tests/test_prunecategories.py

@@ -6,10 +6,9 @@ from django.utils import timezone
 from django.utils.six import StringIO
 from django.utils.six import StringIO
 from django.utils.six.moves import range
 from django.utils.six.moves import range
 
 
-from misago.threads import testutils
-
 from misago.categories.management.commands import prunecategories
 from misago.categories.management.commands import prunecategories
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.threads import testutils
 
 
 
 
 class PruneCategoriesTests(TestCase):
 class PruneCategoriesTests(TestCase):

+ 1 - 2
misago/categories/tests/test_synchronizecategories.py

@@ -3,10 +3,9 @@ from django.test import TestCase
 from django.utils.six import StringIO
 from django.utils.six import StringIO
 from django.utils.six.moves import range
 from django.utils.six.moves import range
 
 
-from misago.threads import testutils
-
 from misago.categories.management.commands import synchronizecategories
 from misago.categories.management.commands import synchronizecategories
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.threads import testutils
 
 
 
 
 class SynchronizeCategoriesTests(TestCase):
 class SynchronizeCategoriesTests(TestCase):

+ 2 - 3
misago/categories/tests/test_utils.py

@@ -1,9 +1,8 @@
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-from misago.core import threadstore
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.categories.utils import get_categories_tree, get_category_path
 from misago.categories.utils import get_categories_tree, get_category_path
+from misago.core import threadstore
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class CategoriesUtilsTests(AuthenticatedUserTestCase):
 class CategoriesUtilsTests(AuthenticatedUserTestCase):

+ 1 - 2
misago/categories/tests/test_views.py

@@ -1,10 +1,9 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.categories.utils import get_categories_tree
 from misago.categories.utils import get_categories_tree
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class CategoryViewsTests(AuthenticatedUserTestCase):
 class CategoryViewsTests(AuthenticatedUserTestCase):

+ 1 - 2
misago/categories/urls/api.py

@@ -1,6 +1,5 @@
-from misago.core.apirouter import MisagoApiRouter
-
 from misago.categories.api import CategoryViewSet
 from misago.categories.api import CategoryViewSet
+from misago.core.apirouter import MisagoApiRouter
 
 
 
 
 router = MisagoApiRouter()
 router = MisagoApiRouter()

+ 1 - 2
misago/categories/views/categoriesadmin.py

@@ -4,11 +4,10 @@ from django.utils.translation import ugettext_lazy as _
 
 
 from misago.acl import version as acl_version
 from misago.acl import version as acl_version
 from misago.admin.views import generic
 from misago.admin.views import generic
-from misago.threads.threadtypes import trees_map
-
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.forms import CategoryFormFactory, DeleteFormFactory
 from misago.categories.forms import CategoryFormFactory, DeleteFormFactory
 from misago.categories.models import Category, RoleCategoryACL
 from misago.categories.models import Category, RoleCategoryACL
+from misago.threads.threadtypes import trees_map
 
 
 
 
 class CategoryAdmin(generic.AdminBaseMixin):
 class CategoryAdmin(generic.AdminBaseMixin):

+ 3 - 2
misago/categories/views/permsadmin.py

@@ -7,9 +7,10 @@ from misago.acl.forms import get_permissions_forms
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.acl.views import RoleAdmin, RolesList
 from misago.acl.views import RoleAdmin, RolesList
 from misago.admin.views import generic
 from misago.admin.views import generic
-
-from misago.categories.forms import CategoryRoleForm, CategoryRolesACLFormFactory, RoleCategoryACLFormFactory
+from misago.categories.forms import (
+    CategoryRoleForm, CategoryRolesACLFormFactory, RoleCategoryACLFormFactory)
 from misago.categories.models import Category, CategoryRole, RoleCategoryACL
 from misago.categories.models import Category, CategoryRole, RoleCategoryACL
+
 from .categoriesadmin import CategoriesList, CategoryAdmin
 from .categoriesadmin import CategoriesList, CategoryAdmin
 
 
 
 

+ 2 - 1
misago/conf/context_processors.py

@@ -4,7 +4,8 @@ from django.contrib.staticfiles.templatetags.staticfiles import static
 from django.urls import reverse
 from django.urls import reverse
 from django.utils.translation import get_language
 from django.utils.translation import get_language
 
 
-from .gateway import db_settings, settings as misago_settings  # noqa
+from .gateway import settings as misago_settings  # noqa
+from .gateway import db_settings
 
 
 
 
 BLANK_AVATAR_URL = static(misago_settings.MISAGO_BLANK_AVATAR)
 BLANK_AVATAR_URL = static(misago_settings.MISAGO_BLANK_AVATAR)

+ 2 - 1
misago/conf/forms.py

@@ -1,5 +1,6 @@
 from django import forms
 from django import forms
-from django.utils.translation import ugettext as _, ungettext
+from django.utils.translation import ugettext as _
+from django.utils.translation import ungettext
 
 
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
 
 

+ 0 - 1
misago/conf/tests/test_admin_views.py

@@ -1,7 +1,6 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
-
 from misago.conf.models import SettingsGroup
 from misago.conf.models import SettingsGroup
 
 
 
 

+ 1 - 2
misago/conf/tests/test_context_processors.py

@@ -1,9 +1,8 @@
 from django.test import TestCase
 from django.test import TestCase
 
 
-from misago.core import threadstore
-
 from misago.conf.context_processors import settings
 from misago.conf.context_processors import settings
 from misago.conf.dbsettings import db_settings
 from misago.conf.dbsettings import db_settings
+from misago.core import threadstore
 
 
 
 
 class MockRequest(object):
 class MockRequest(object):

+ 1 - 2
misago/conf/tests/test_migrationutils.py

@@ -1,10 +1,9 @@
 from django.apps import apps
 from django.apps import apps
 from django.test import TestCase
 from django.test import TestCase
 
 
-from misago.core import threadstore
-
 from misago.conf import migrationutils
 from misago.conf import migrationutils
 from misago.conf.models import SettingsGroup
 from misago.conf.models import SettingsGroup
+from misago.core import threadstore
 
 
 
 
 class DBConfMigrationUtilsTests(TestCase):
 class DBConfMigrationUtilsTests(TestCase):

+ 2 - 3
misago/conf/tests/test_settings.py

@@ -2,13 +2,12 @@ from django.apps import apps
 from django.conf import settings as dj_settings
 from django.conf import settings as dj_settings
 from django.test import TestCase, override_settings
 from django.test import TestCase, override_settings
 
 
-from misago.core import threadstore
-from misago.core.cache import cache
-
 from misago.conf import defaults
 from misago.conf import defaults
 from misago.conf.dbsettings import db_settings
 from misago.conf.dbsettings import db_settings
 from misago.conf.gateway import settings as gateway
 from misago.conf.gateway import settings as gateway
 from misago.conf.migrationutils import migrate_settings_group
 from misago.conf.migrationutils import migrate_settings_group
+from misago.core import threadstore
+from misago.core.cache import cache
 
 
 
 
 class DBSettingsTests(TestCase):
 class DBSettingsTests(TestCase):

+ 2 - 2
misago/core/apipatch.py

@@ -1,9 +1,9 @@
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db import transaction
 from django.db import transaction
 from django.http import Http404
 from django.http import Http404
 
 
-from rest_framework.response import Response
-
 
 
 ALLOWED_OPS = ('add', 'remove', 'replace')
 ALLOWED_OPS = ('add', 'remove', 'replace')
 
 

+ 2 - 2
misago/core/exceptionhandler.py

@@ -1,11 +1,11 @@
+from rest_framework.views import exception_handler as rest_exception_handler
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.http import Http404, HttpResponsePermanentRedirect, JsonResponse
 from django.http import Http404, HttpResponsePermanentRedirect, JsonResponse
 from django.urls import reverse
 from django.urls import reverse
 from django.utils import six
 from django.utils import six
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 
 
-from rest_framework.views import exception_handler as rest_exception_handler
-
 from . import errorpages
 from . import errorpages
 from .exceptions import AjaxError, Banned, ExplicitFirstPage, OutdatedSlug
 from .exceptions import AjaxError, Banned, ExplicitFirstPage, OutdatedSlug
 
 

+ 1 - 2
misago/core/forms.py

@@ -1,5 +1,4 @@
-from django.forms import (
-    DateTimeField, RadioSelect, TypedChoiceField, ValidationError)
+from django.forms import DateTimeField, RadioSelect, TypedChoiceField, ValidationError
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from .utils import parse_iso8601_string
 from .utils import parse_iso8601_string

+ 0 - 1
misago/core/momentjs.py

@@ -27,4 +27,3 @@ def clean_language_name(language):
 
 
     # nothing was found
     # nothing was found
     return None
     return None
-

+ 2 - 2
misago/core/rest_permissions.py

@@ -1,8 +1,8 @@
+from rest_framework.permissions import SAFE_METHODS, BasePermission
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
-from rest_framework.permissions import SAFE_METHODS, BasePermission
-
 
 
 class IsAuthenticatedOrReadOnly(BasePermission):
 class IsAuthenticatedOrReadOnly(BasePermission):
     def has_permission(self, request, view):
     def has_permission(self, request, view):

+ 2 - 2
misago/core/shortcuts.py

@@ -1,9 +1,9 @@
-import six
+from rest_framework.response import Response
 
 
 from django.http import Http404
 from django.http import Http404
 from django.shortcuts import *  # noqa
 from django.shortcuts import *  # noqa
 
 
-from rest_framework.response import Response
+import six
 
 
 
 
 def paginate(object_list, page, per_page, orphans=0,
 def paginate(object_list, page, per_page, orphans=0,

+ 1 - 0
misago/core/templatetags/misago_json.py

@@ -5,6 +5,7 @@ from django.utils.safestring import mark_safe
 
 
 from misago.core.utils import encode_json_html
 from misago.core.utils import encode_json_html
 
 
+
 register = template.Library()
 register = template.Library()
 
 
 
 

+ 1 - 1
misago/core/testproject/urls.py

@@ -2,9 +2,9 @@ from django.conf.urls import include, url
 # Setup Django admin to work with Misago auth
 # Setup Django admin to work with Misago auth
 from django.contrib import admin
 from django.contrib import admin
 
 
+from misago.core.views import javascript_catalog
 from misago.users.forms.auth import AdminAuthenticationForm
 from misago.users.forms.auth import AdminAuthenticationForm
 
 
-from misago.core.views import javascript_catalog
 from . import views
 from . import views
 
 
 
 

+ 4 - 4
misago/core/testproject/views.py

@@ -1,16 +1,16 @@
+from rest_framework.decorators import api_view
+
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.http import Http404, HttpResponse
 from django.http import Http404, HttpResponse
 
 
-from rest_framework.decorators import api_view
-
-from misago.users.models import Ban
-
 from misago.core import errorpages, mail
 from misago.core import errorpages, mail
 from misago.core.decorators import require_POST
 from misago.core.decorators import require_POST
 from misago.core.exceptions import Banned
 from misago.core.exceptions import Banned
 from misago.core.shortcuts import paginate, paginated_response, validate_slug
 from misago.core.shortcuts import paginate, paginated_response, validate_slug
 from misago.core.views import home_redirect
 from misago.core.views import home_redirect
+from misago.users.models import Ban
+
 from .models import Model
 from .models import Model
 from .serializers import MockSerializer
 from .serializers import MockSerializer
 
 

+ 1 - 2
misago/core/tests/test_errorpages.py

@@ -2,10 +2,9 @@ from django.test import Client, TestCase, override_settings
 from django.test.client import RequestFactory
 from django.test.client import RequestFactory
 from django.urls import reverse
 from django.urls import reverse
 
 
-from misago.users.models import AnonymousUser
-
 from misago.core.testproject.views import mock_custom_403_error_page, mock_custom_404_error_page
 from misago.core.testproject.views import mock_custom_403_error_page, mock_custom_404_error_page
 from misago.core.utils import encode_json_html
 from misago.core.utils import encode_json_html
+from misago.users.models import AnonymousUser
 
 
 
 
 class CSRFErrorViewTests(TestCase):
 class CSRFErrorViewTests(TestCase):

+ 1 - 2
misago/core/tests/test_exceptionhandler_middleware.py

@@ -3,9 +3,8 @@ from django.test import TestCase
 from django.test.client import RequestFactory
 from django.test.client import RequestFactory
 from django.urls import reverse
 from django.urls import reverse
 
 
-from misago.users.models import AnonymousUser
-
 from misago.core.middleware.exceptionhandler import ExceptionHandlerMiddleware
 from misago.core.middleware.exceptionhandler import ExceptionHandlerMiddleware
+from misago.users.models import AnonymousUser
 
 
 
 
 class ExceptionHandlerMiddlewareTests(TestCase):
 class ExceptionHandlerMiddlewareTests(TestCase):

+ 1 - 2
misago/core/tests/test_exceptionhandlers.py

@@ -3,10 +3,9 @@ from django.core.exceptions import PermissionDenied
 from django.http import Http404
 from django.http import Http404
 from django.test import TestCase
 from django.test import TestCase
 
 
-from misago.users.models import Ban
-
 from misago.core import exceptionhandler
 from misago.core import exceptionhandler
 from misago.core.exceptions import Banned
 from misago.core.exceptions import Banned
+from misago.users.models import Ban
 
 
 
 
 INVALID_EXCEPTIONS = (
 INVALID_EXCEPTIONS = (

+ 1 - 1
misago/core/tests/test_momentjs.py

@@ -1,7 +1,7 @@
 from django.conf import settings
 from django.conf import settings
 from django.test import TestCase
 from django.test import TestCase
 
 
-from misago.core.momentjs import get_locale_url, clean_language_name
+from misago.core.momentjs import clean_language_name, get_locale_url
 
 
 
 
 class MomentJSTests(TestCase):
 class MomentJSTests(TestCase):

+ 3 - 8
misago/core/tests/test_utils.py

@@ -1,19 +1,14 @@
 #-*- coding: utf-8 -*-
 #-*- coding: utf-8 -*-
 from __future__ import unicode_literals
 from __future__ import unicode_literals
+
 from django.test import TestCase
 from django.test import TestCase
 from django.test.client import RequestFactory
 from django.test.client import RequestFactory
 from django.urls import reverse
 from django.urls import reverse
 from django.utils import six, timezone
 from django.utils import six, timezone
 
 
 from misago.core.utils import (
 from misago.core.utils import (
-    clean_return_path,
-    format_plaintext_for_html,
-    is_referer_local,
-    is_request_to_misago,
-    parse_iso8601_string,
-    resolve_slugify,
-    slugify
-)
+    clean_return_path, format_plaintext_for_html, is_referer_local, is_request_to_misago,
+    parse_iso8601_string, resolve_slugify, slugify)
 
 
 
 
 VALID_PATHS = (
 VALID_PATHS = (

+ 2 - 2
misago/datamover/attachments.py

@@ -5,10 +5,10 @@ import os
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.files import File
 from django.core.files import File
 
 
-from misago.threads.models import Attachment, AttachmentType, Thread, Post
+from misago.threads.models import Attachment, AttachmentType, Post, Thread
 from misago.threads.serializers import AttachmentSerializer
 from misago.threads.serializers import AttachmentSerializer
 
 
-from . import OLD_FORUM, fetch_assoc, movedids, localise_datetime
+from . import OLD_FORUM, fetch_assoc, localise_datetime, movedids
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 1
misago/datamover/avatars.py

@@ -6,7 +6,7 @@ from django.contrib.auth import get_user_model
 from django.core.exceptions import ValidationError
 from django.core.exceptions import ValidationError
 
 
 from misago.conf import settings
 from misago.conf import settings
-from misago.users.avatars import store, gravatar, dynamic, gallery, uploaded
+from misago.users.avatars import dynamic, gallery, gravatar, store, uploaded
 
 
 from . import OLD_FORUM, fetch_assoc, movedids
 from . import OLD_FORUM, fetch_assoc, movedids
 
 

+ 1 - 2
misago/datamover/management/commands/buildmovesindex.py

@@ -1,7 +1,6 @@
 from misago.core.pgutils import batch_update
 from misago.core.pgutils import batch_update
-
-from misago.datamover.models import MovedId, OldIdRedirect
 from misago.datamover.management.base import BaseCommand
 from misago.datamover.management.base import BaseCommand
+from misago.datamover.models import MovedId, OldIdRedirect
 
 
 
 
 MAPPINGS = {
 MAPPINGS = {

+ 1 - 1
misago/datamover/management/commands/movesettings.py

@@ -1,5 +1,5 @@
-from misago.datamover.settings import move_settings
 from misago.datamover.management.base import BaseCommand
 from misago.datamover.management.base import BaseCommand
+from misago.datamover.settings import move_settings
 
 
 
 
 class Command(BaseCommand):
 class Command(BaseCommand):

+ 1 - 2
misago/datamover/markup/attachments.py

@@ -2,9 +2,8 @@ from __future__ import unicode_literals
 
 
 import re
 import re
 
 
-from misago.threads.models import Attachment
-
 from misago.datamover import fetch_assoc, movedids
 from misago.datamover import fetch_assoc, movedids
+from misago.threads.models import Attachment
 
 
 
 
 ATTACHMENT_RE = re.compile(r'/attachment/(?P<hash>[a-z0-9]+)/')
 ATTACHMENT_RE = re.compile(r'/attachment/(?P<hash>[a-z0-9]+)/')

+ 2 - 2
misago/datamover/polls.py

@@ -1,9 +1,9 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.utils.crypto import get_random_string
 from django.utils.crypto import get_random_string
 
 
-from misago.threads.models import Thread, Poll, PollVote
+from misago.threads.models import Poll, PollVote, Thread
 
 
-from . import fetch_assoc, movedids, localise_datetime
+from . import fetch_assoc, localise_datetime, movedids
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 2 - 3
misago/datamover/threads.py

@@ -5,10 +5,9 @@ from django.utils import timezone
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.threads.checksums import update_post_checksum
 from misago.threads.checksums import update_post_checksum
-from misago.threads.models import (
-    Thread, ThreadParticipant, Post, PostEdit, PostLike)
+from misago.threads.models import Post, PostEdit, PostLike, Thread, ThreadParticipant
 
 
-from . import fetch_assoc, markup, movedids, localise_datetime
+from . import fetch_assoc, localise_datetime, markup, movedids
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 1
misago/datamover/users.py

@@ -7,7 +7,7 @@ from django.utils.crypto import get_random_string
 from misago.users.models import UsernameChange
 from misago.users.models import UsernameChange
 from misago.users.signatures import make_signature_checksum
 from misago.users.signatures import make_signature_checksum
 
 
-from . import fetch_assoc, movedids, localise_datetime
+from . import fetch_assoc, localise_datetime, movedids
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 2
misago/datamover/views.py

@@ -1,8 +1,7 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.shortcuts import get_object_or_404, redirect
 from django.shortcuts import get_object_or_404, redirect
 
 
-from misago.threads.viewmodels import (
-    ForumThread, PrivateThread, ThreadPost, ThreadsCategory)
+from misago.threads.viewmodels import ForumThread, PrivateThread, ThreadPost, ThreadsCategory
 
 
 from .models import OldIdRedirect
 from .models import OldIdRedirect
 
 

+ 1 - 1
misago/faker/englishcorpus.py

@@ -1,6 +1,6 @@
 import codecs
 import codecs
-import random
 import os
 import os
+import random
 
 
 
 
 PHRASES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'phrases.txt')
 PHRASES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'phrases.txt')

+ 1 - 2
misago/faker/management/commands/createfakethreads.py

@@ -13,11 +13,10 @@ from django.utils.six.moves import range
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.core.management.progressbar import show_progress
 from misago.core.management.progressbar import show_progress
+from misago.faker.englishcorpus import EnglishCorpus
 from misago.threads.checksums import update_post_checksum
 from misago.threads.checksums import update_post_checksum
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 
 
-from misago.faker.englishcorpus import EnglishCorpus
-
 
 
 PLACEKITTEN_URL = 'https://placekitten.com/g/%s/%s'
 PLACEKITTEN_URL = 'https://placekitten.com/g/%s/%s'
 
 

+ 4 - 4
misago/markup/api.py

@@ -1,11 +1,11 @@
-from django.core.exceptions import ValidationError
-from django.utils import six
-from django.utils.translation import ugettext as _
-
 from rest_framework import status
 from rest_framework import status
 from rest_framework.decorators import api_view
 from rest_framework.decorators import api_view
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.core.exceptions import ValidationError
+from django.utils import six
+from django.utils.translation import ugettext as _
+
 from misago.threads.validators import validate_post
 from misago.threads.validators import validate_post
 
 
 from . import common_flavour, finalise_markup
 from . import common_flavour, finalise_markup

+ 1 - 1
misago/markup/parser.py

@@ -6,11 +6,11 @@ import bleach
 import markdown
 import markdown
 from bs4 import BeautifulSoup
 from bs4 import BeautifulSoup
 from htmlmin.minify import html_minify
 from htmlmin.minify import html_minify
+from markdown.extensions.fenced_code import FencedCodeExtension
 
 
 from django.http import Http404
 from django.http import Http404
 from django.urls import resolve
 from django.urls import resolve
 from django.utils import six
 from django.utils import six
-from markdown.extensions.fenced_code import FencedCodeExtension
 
 
 from .bbcode import blocks, inline
 from .bbcode import blocks, inline
 from .md.shortimgs import ShortImagesExtension
 from .md.shortimgs import ShortImagesExtension

+ 1 - 2
misago/markup/tests/test_mentions.py

@@ -1,6 +1,5 @@
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.markup.mentions import add_mentions
 from misago.markup.mentions import add_mentions
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class MockRequest(object):
 class MockRequest(object):

+ 1 - 0
misago/project_template/manage.py

@@ -2,6 +2,7 @@
 import os
 import os
 import sys
 import sys
 
 
+
 if __name__ == "__main__":
 if __name__ == "__main__":
     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
     try:
     try:

+ 1 - 0
misago/project_template/project_name/settings.py

@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
 
 
 import os
 import os
 
 
+
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
 

+ 1 - 0
misago/project_template/project_name/wsgi.py

@@ -11,6 +11,7 @@ import os
 
 
 from django.core.wsgi import get_wsgi_application
 from django.core.wsgi import get_wsgi_application
 
 
+
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
 
 
 application = get_wsgi_application()
 application = get_wsgi_application()

+ 1 - 2
misago/readtracker/tests/test_readtracker.py

@@ -6,11 +6,10 @@ from django.utils import timezone
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
+from misago.readtracker import categoriestracker, threadstracker
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.users.models import AnonymousUser
 from misago.users.models import AnonymousUser
 
 
-from misago.readtracker import categoriestracker, threadstracker
-
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()
 
 

+ 4 - 4
misago/search/api.py

@@ -1,12 +1,12 @@
 from time import time
 from time import time
 
 
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.urls import reverse
 from django.urls import reverse
-from django.utils.translation import ugettext as _
 from django.utils import six
 from django.utils import six
-
-from rest_framework.decorators import api_view
-from rest_framework.response import Response
+from django.utils.translation import ugettext as _
 
 
 from misago.core.shortcuts import get_int_or_404
 from misago.core.shortcuts import get_int_or_404
 
 

+ 1 - 2
misago/search/tests/test_api.py

@@ -2,9 +2,8 @@ from django.urls import reverse
 from django.utils import six
 from django.utils import six
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.search.searchproviders import searchproviders
 from misago.search.searchproviders import searchproviders
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class SearchApiTests(AuthenticatedUserTestCase):
 class SearchApiTests(AuthenticatedUserTestCase):

+ 0 - 1
misago/search/tests/test_searchproviders.py

@@ -2,7 +2,6 @@ from django.core.exceptions import PermissionDenied
 from django.test import TestCase
 from django.test import TestCase
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.search.searchprovider import SearchProvider
 from misago.search.searchprovider import SearchProvider
 from misago.search.searchproviders import SearchProviders
 from misago.search.searchproviders import SearchProviders
 
 

+ 1 - 5
misago/threads/admin.py

@@ -3,11 +3,7 @@ from django.utils.translation import ugettext_lazy as _
 
 
 from .views.admin.attachments import AttachmentsList, DeleteAttachment
 from .views.admin.attachments import AttachmentsList, DeleteAttachment
 from .views.admin.attachmenttypes import (
 from .views.admin.attachmenttypes import (
-    AttachmentTypesList,
-    DeleteAttachmentType,
-    EditAttachmentType,
-    NewAttachmentType
-)
+    AttachmentTypesList, DeleteAttachmentType, EditAttachmentType, NewAttachmentType)
 
 
 
 
 class MisagoAdminExtension(object):
 class MisagoAdminExtension(object):

+ 3 - 4
misago/threads/api/attachments.py

@@ -1,12 +1,11 @@
+from rest_framework import viewsets
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.template.defaultfilters import filesizeformat
 from django.template.defaultfilters import filesizeformat
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 
 
-from rest_framework import viewsets
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
-
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.serializers import AttachmentSerializer
 from misago.threads.serializers import AttachmentSerializer
 
 

+ 2 - 3
misago/threads/api/pollvotecreateendpoint.py

@@ -1,14 +1,13 @@
 from copy import deepcopy
 from copy import deepcopy
 
 
+from rest_framework.response import Response
+
 from django.core.exceptions import ValidationError
 from django.core.exceptions import ValidationError
 from django.utils import six
 from django.utils import six
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
-
 from misago.threads.permissions.polls import allow_vote_poll
 from misago.threads.permissions.polls import allow_vote_poll
 from misago.threads.serializers import PollSerializer
 from misago.threads.serializers import PollSerializer
 
 

+ 3 - 4
misago/threads/api/postendpoints/edits.py

@@ -1,18 +1,17 @@
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db.models import F
 from django.db.models import F
 from django.http import Http404
 from django.http import Http404
 from django.utils import timezone
 from django.utils import timezone
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.markup import common_flavour
 from misago.markup import common_flavour
-from misago.users.online.utils import make_users_status_aware
-
 from misago.threads.checksums import update_post_checksum
 from misago.threads.checksums import update_post_checksum
 from misago.threads.serializers import PostEditSerializer, PostSerializer
 from misago.threads.serializers import PostEditSerializer, PostSerializer
+from misago.users.online.utils import make_users_status_aware
 
 
 
 
 def get_edit_endpoint(request, post):
 def get_edit_endpoint(request, post):

+ 2 - 3
misago/threads/api/postendpoints/merge.py

@@ -1,12 +1,11 @@
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.serializers import PostSerializer
 from misago.threads.serializers import PostSerializer
 
 

+ 4 - 4
misago/threads/api/postendpoints/move.py

@@ -1,12 +1,12 @@
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.http import Http404
 from django.http import Http404
 from django.utils import six
 from django.utils import six
-from django.utils.translation import ugettext as _, ungettext
-
-from rest_framework.response import Response
+from django.utils.translation import ugettext as _
+from django.utils.translation import ungettext
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads.permissions.threads import allow_move_post, exclude_invisible_posts
 from misago.threads.permissions.threads import allow_move_post, exclude_invisible_posts
 from misago.threads.utils import get_thread_id_from_url
 from misago.threads.utils import get_thread_id_from_url
 
 

+ 0 - 1
misago/threads/api/postendpoints/patch_event.py

@@ -3,7 +3,6 @@ from django.utils.translation import gettext as _
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.core.apipatch import ApiPatch
 from misago.core.apipatch import ApiPatch
-
 from misago.threads.moderation import posts as moderation
 from misago.threads.moderation import posts as moderation
 
 
 
 

+ 0 - 1
misago/threads/api/postendpoints/patch_post.py

@@ -3,7 +3,6 @@ from django.utils.translation import gettext as _
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.core.apipatch import ApiPatch
 from misago.core.apipatch import ApiPatch
-
 from misago.threads.models import PostLike
 from misago.threads.models import PostLike
 from misago.threads.moderation import posts as moderation
 from misago.threads.moderation import posts as moderation
 from misago.threads.permissions.threads import (
 from misago.threads.permissions.threads import (

+ 3 - 4
misago/threads/api/postendpoints/split.py

@@ -1,12 +1,11 @@
+from rest_framework import serializers
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework import serializers
-from rest_framework.response import Response
-
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads.events import record_event
 from misago.threads.events import record_event
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 from misago.threads.moderation import threads as moderation
 from misago.threads.moderation import threads as moderation

+ 3 - 3
misago/threads/api/postingendpoint/attachments.py

@@ -1,13 +1,13 @@
+from rest_framework import serializers
+
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework import serializers
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.conf import settings
 from misago.conf import settings
+from misago.threads.serializers import AttachmentSerializer
 
 
 from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
 from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
-from misago.threads.serializers import AttachmentSerializer
 
 
 
 
 class AttachmentsMiddleware(PostingMiddleware):
 class AttachmentsMiddleware(PostingMiddleware):

+ 4 - 4
misago/threads/api/postingendpoint/category.py

@@ -1,18 +1,18 @@
+from rest_framework import serializers
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext_lazy
 from django.utils.translation import ugettext_lazy
 
 
-from rest_framework import serializers
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.categories.permissions import can_browse_category, can_see_category
 from misago.categories.permissions import can_browse_category, can_see_category
-
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads.permissions.threads import allow_start_thread
 from misago.threads.permissions.threads import allow_start_thread
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 class CategoryMiddleware(PostingMiddleware):
 class CategoryMiddleware(PostingMiddleware):
     """
     """

+ 2 - 1
misago/threads/api/postingendpoint/close.py

@@ -1,6 +1,7 @@
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads import moderation
 from misago.threads import moderation
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 class CloseMiddleware(PostingMiddleware):
 class CloseMiddleware(PostingMiddleware):
     def use_this_middleware(self):
     def use_this_middleware(self):

+ 1 - 1
misago/threads/api/postingendpoint/emailnotification.py

@@ -1,9 +1,9 @@
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
 from misago.core.mail import build_mail, send_messages
 from misago.core.mail import build_mail, send_messages
+from misago.threads.permissions.threads import can_see_post, can_see_thread
 
 
 from . import PostingEndpoint, PostingMiddleware
 from . import PostingEndpoint, PostingMiddleware
-from misago.threads.permissions.threads import can_see_post, can_see_thread
 
 
 
 
 class EmailNotificationMiddleware(PostingMiddleware):
 class EmailNotificationMiddleware(PostingMiddleware):

+ 2 - 1
misago/threads/api/postingendpoint/hide.py

@@ -1,6 +1,7 @@
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads import moderation
 from misago.threads import moderation
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 class HideMiddleware(PostingMiddleware):
 class HideMiddleware(PostingMiddleware):
     def use_this_middleware(self):
     def use_this_middleware(self):

+ 4 - 4
misago/threads/api/postingendpoint/participants.py

@@ -1,17 +1,17 @@
+from rest_framework import serializers
+
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils import six
 from django.utils import six
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework import serializers
-
 from misago.categories import PRIVATE_THREADS_ROOT_NAME
 from misago.categories import PRIVATE_THREADS_ROOT_NAME
-
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads.participants import add_participants, set_owner
 from misago.threads.participants import add_participants, set_owner
 from misago.threads.permissions import allow_message_user
 from misago.threads.permissions import allow_message_user
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()
 
 

+ 2 - 1
misago/threads/api/postingendpoint/pin.py

@@ -1,7 +1,8 @@
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads import moderation
 from misago.threads import moderation
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 class PinMiddleware(PostingMiddleware):
 class PinMiddleware(PostingMiddleware):
     def use_this_middleware(self):
     def use_this_middleware(self):

+ 4 - 4
misago/threads/api/postingendpoint/reply.py

@@ -1,15 +1,15 @@
+from rest_framework import serializers
+
 from django.db.models import F
 from django.db.models import F
 from django.utils.translation import ugettext_lazy
 from django.utils.translation import ugettext_lazy
 
 
-from rest_framework import serializers
-
 from misago.conf import settings
 from misago.conf import settings
 from misago.markup import common_flavour
 from misago.markup import common_flavour
-
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads.checksums import update_post_checksum
 from misago.threads.checksums import update_post_checksum
 from misago.threads.validators import validate_post, validate_title
 from misago.threads.validators import validate_post, validate_title
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 class ReplyMiddleware(PostingMiddleware):
 class ReplyMiddleware(PostingMiddleware):
     def get_serializer(self):
     def get_serializer(self):

+ 2 - 1
misago/threads/api/postingendpoint/subscribe.py

@@ -1,8 +1,9 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 
 
-from . import PostingEndpoint, PostingMiddleware
 from misago.threads.models import Subscription
 from misago.threads.models import Subscription
 
 
+from . import PostingEndpoint, PostingMiddleware
+
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()
 
 

+ 1 - 1
misago/threads/api/postingendpoint/syncprivatethreads.py

@@ -1,6 +1,6 @@
 from misago.categories import PRIVATE_THREADS_ROOT_NAME
 from misago.categories import PRIVATE_THREADS_ROOT_NAME
-
 from misago.threads.participants import set_users_unread_private_threads_sync
 from misago.threads.participants import set_users_unread_private_threads_sync
+
 from . import PostingEndpoint, PostingMiddleware
 from . import PostingEndpoint, PostingMiddleware
 
 
 
 

+ 2 - 3
misago/threads/api/threadendpoints/editor.py

@@ -1,12 +1,11 @@
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 
 
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.permissions.threads import can_start_thread
 from misago.threads.permissions.threads import can_start_thread
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
 
 

+ 2 - 2
misago/threads/api/threadendpoints/list.py

@@ -1,8 +1,8 @@
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
 from misago.core.shortcuts import get_int_or_404
 from misago.core.shortcuts import get_int_or_404
-
-from misago.threads.viewmodels.category import PrivateThreadsCategory, ThreadsCategory, ThreadsRootCategory
+from misago.threads.viewmodels.category import (
+    PrivateThreadsCategory, ThreadsCategory, ThreadsRootCategory)
 from misago.threads.viewmodels.threads import ForumThreads, PrivateThreads
 from misago.threads.viewmodels.threads import ForumThreads, PrivateThreads
 
 
 
 

+ 3 - 3
misago/threads/api/threadendpoints/merge.py

@@ -1,14 +1,13 @@
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.http import Http404
 from django.http import Http404
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.events import record_event
 from misago.threads.events import record_event
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 from misago.threads.moderation import threads as moderation
 from misago.threads.moderation import threads as moderation
@@ -16,6 +15,7 @@ from misago.threads.permissions import can_reply_thread, can_see_thread
 from misago.threads.serializers import NewThreadSerializer, ThreadsListSerializer
 from misago.threads.serializers import NewThreadSerializer, ThreadsListSerializer
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
 from misago.threads.utils import add_categories_to_items, get_thread_id_from_url
 from misago.threads.utils import add_categories_to_items, get_thread_id_from_url
+
 from .pollmergehandler import PollMergeHandler
 from .pollmergehandler import PollMergeHandler
 
 
 
 

+ 1 - 3
misago/threads/api/threadendpoints/patch.py

@@ -9,14 +9,12 @@ from misago.categories.permissions import allow_browse_category, allow_see_categ
 from misago.categories.serializers import CategorySerializer
 from misago.categories.serializers import CategorySerializer
 from misago.core.apipatch import ApiPatch
 from misago.core.apipatch import ApiPatch
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
-
 from misago.threads.models import ThreadParticipant
 from misago.threads.models import ThreadParticipant
 from misago.threads.moderation import threads as moderation
 from misago.threads.moderation import threads as moderation
 from misago.threads.participants import (
 from misago.threads.participants import (
     add_participant, change_owner, make_participants_aware, remove_participant)
     add_participant, change_owner, make_participants_aware, remove_participant)
 from misago.threads.permissions import (
 from misago.threads.permissions import (
-    allow_add_participants, allow_add_participant,
-    allow_change_owner, allow_edit_thread,
+    allow_add_participant, allow_add_participants, allow_change_owner, allow_edit_thread,
     allow_remove_participant, allow_start_thread)
     allow_remove_participant, allow_start_thread)
 from misago.threads.serializers import ThreadParticipantSerializer
 from misago.threads.serializers import ThreadParticipantSerializer
 from misago.threads.utils import add_categories_to_items
 from misago.threads.utils import add_categories_to_items

+ 0 - 1
misago/threads/api/threadendpoints/read.py

@@ -3,7 +3,6 @@ from misago.categories.models import Category
 from misago.categories.permissions import allow_browse_category, allow_see_category
 from misago.categories.permissions import allow_browse_category, allow_see_category
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.readtracker.categoriestracker import read_category
 from misago.readtracker.categoriestracker import read_category
-
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
 
 
 
 

+ 6 - 11
misago/threads/api/threadpoll.py

@@ -1,26 +1,21 @@
+from rest_framework import viewsets
+from rest_framework.decorators import detail_route
+from rest_framework.response import Response
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db import transaction
 from django.db import transaction
 from django.http import Http404
 from django.http import Http404
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 
 
-from rest_framework import viewsets
-from rest_framework.decorators import detail_route
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.core.shortcuts import get_int_or_404
 from misago.core.shortcuts import get_int_or_404
-
 from misago.threads.models import Poll
 from misago.threads.models import Poll
 from misago.threads.permissions.polls import (
 from misago.threads.permissions.polls import (
-    allow_delete_poll,
-    allow_edit_poll,
-    allow_see_poll_votes,
-    allow_start_poll,
-    can_start_poll
-)
+    allow_delete_poll, allow_edit_poll, allow_see_poll_votes, allow_start_poll, can_start_poll)
 from misago.threads.serializers import (
 from misago.threads.serializers import (
     EditPollSerializer, NewPollSerializer, PollSerializer, PollVoteSerializer)
     EditPollSerializer, NewPollSerializer, PollSerializer, PollVoteSerializer)
 from misago.threads.viewmodels import ForumThread
 from misago.threads.viewmodels import ForumThread
+
 from .pollvotecreateendpoint import poll_vote_create
 from .pollvotecreateendpoint import poll_vote_create
 
 
 
 

+ 8 - 7
misago/threads/api/threadposts.py

@@ -1,20 +1,21 @@
-from django.core.exceptions import PermissionDenied
-from django.db import transaction
-from django.utils.translation import ugettext as _
-
 from rest_framework import viewsets
 from rest_framework import viewsets
 from rest_framework.decorators import detail_route, list_route
 from rest_framework.decorators import detail_route, list_route
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.core.exceptions import PermissionDenied
+from django.db import transaction
+from django.utils.translation import ugettext as _
+
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.core.shortcuts import get_int_or_404
 from misago.core.shortcuts import get_int_or_404
-from misago.users.online.utils import make_users_status_aware
-
 from misago.threads.models import Post
 from misago.threads.models import Post
 from misago.threads.moderation import posts as moderation
 from misago.threads.moderation import posts as moderation
-from misago.threads.permissions.threads import allow_delete_event, allow_delete_post, allow_edit_post, allow_reply_thread
+from misago.threads.permissions.threads import (
+    allow_delete_event, allow_delete_post, allow_edit_post, allow_reply_thread)
 from misago.threads.serializers import AttachmentSerializer, PostSerializer
 from misago.threads.serializers import AttachmentSerializer, PostSerializer
 from misago.threads.viewmodels import ForumThread, PrivateThread, ThreadPost, ThreadPosts
 from misago.threads.viewmodels import ForumThread, PrivateThread, ThreadPost, ThreadPosts
+from misago.users.online.utils import make_users_status_aware
+
 from .postendpoints.edits import get_edit_endpoint, revert_post_endpoint
 from .postendpoints.edits import get_edit_endpoint, revert_post_endpoint
 from .postendpoints.likes import likes_list_endpoint
 from .postendpoints.likes import likes_list_endpoint
 from .postendpoints.merge import posts_merge_endpoint
 from .postendpoints.merge import posts_merge_endpoint

+ 5 - 5
misago/threads/api/threads.py

@@ -1,18 +1,18 @@
-from django.core.exceptions import PermissionDenied
-from django.db import transaction
-from django.utils.translation import gettext as _
-
 from rest_framework import viewsets
 from rest_framework import viewsets
 from rest_framework.decorators import detail_route, list_route
 from rest_framework.decorators import detail_route, list_route
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.core.exceptions import PermissionDenied
+from django.db import transaction
+from django.utils.translation import gettext as _
+
 from misago.categories import PRIVATE_THREADS_ROOT_NAME, THREADS_ROOT_NAME
 from misago.categories import PRIVATE_THREADS_ROOT_NAME, THREADS_ROOT_NAME
 from misago.core.shortcuts import get_int_or_404
 from misago.core.shortcuts import get_int_or_404
-
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 from misago.threads.moderation import threads as moderation
 from misago.threads.moderation import threads as moderation
 from misago.threads.permissions import allow_use_private_threads
 from misago.threads.permissions import allow_use_private_threads
 from misago.threads.viewmodels import ForumThread, PrivateThread
 from misago.threads.viewmodels import ForumThread, PrivateThread
+
 from .postingendpoint import PostingEndpoint
 from .postingendpoint import PostingEndpoint
 from .threadendpoints.editor import thread_start_editor
 from .threadendpoints.editor import thread_start_editor
 from .threadendpoints.list import private_threads_list_endpoint, threads_list_endpoint
 from .threadendpoints.list import private_threads_list_endpoint, threads_list_endpoint

+ 0 - 1
misago/threads/management/commands/clearattachments.py

@@ -7,7 +7,6 @@ from django.utils import timezone
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.management.progressbar import show_progress
 from misago.core.management.progressbar import show_progress
 from misago.core.pgutils import batch_update
 from misago.core.pgutils import batch_update
-
 from misago.threads.models import Attachment
 from misago.threads.models import Attachment
 
 
 
 

+ 0 - 1
misago/threads/management/commands/rebuildpostssearch.py

@@ -4,7 +4,6 @@ from django.core.management.base import BaseCommand
 
 
 from misago.core.management.progressbar import show_progress
 from misago.core.management.progressbar import show_progress
 from misago.core.pgutils import batch_update
 from misago.core.pgutils import batch_update
-
 from misago.threads.models import Post
 from misago.threads.models import Post
 
 
 
 

+ 0 - 1
misago/threads/management/commands/synchronizethreads.py

@@ -4,7 +4,6 @@ from django.core.management.base import BaseCommand
 
 
 from misago.core.management.progressbar import show_progress
 from misago.core.management.progressbar import show_progress
 from misago.core.pgutils import batch_update
 from misago.core.pgutils import batch_update
-
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 
 
 
 

+ 1 - 1
misago/threads/migrations/0004_update_settings.py

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
 
 
 from django.db import migrations
 from django.db import migrations
 
 
-from misago.conf.migrationutils import migrate_settings_group, delete_settings_cache
+from misago.conf.migrationutils import delete_settings_cache, migrate_settings_group
 
 
 
 
 _ = lambda x: x
 _ = lambda x: x

+ 0 - 1
misago/threads/models/post.py

@@ -13,7 +13,6 @@ from django.utils.encoding import python_2_unicode_compatible
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.utils import parse_iso8601_string
 from misago.core.utils import parse_iso8601_string
 from misago.markup import finalise_markup
 from misago.markup import finalise_markup
-
 from misago.threads import threadtypes
 from misago.threads import threadtypes
 from misago.threads.checksums import is_post_valid, update_post_checksum
 from misago.threads.checksums import is_post_valid, update_post_checksum
 
 

+ 0 - 1
misago/threads/permissions/attachments.py

@@ -4,7 +4,6 @@ from django.utils.translation import ugettext_lazy as _
 from misago.acl import algebra
 from misago.acl import algebra
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.threads.models import Attachment
 from misago.threads.models import Attachment
 
 
 
 

+ 0 - 1
misago/threads/permissions/polls.py

@@ -8,7 +8,6 @@ from misago.acl import algebra
 from misago.acl.decorators import return_boolean
 from misago.acl.decorators import return_boolean
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.threads.models import Poll, Thread
 from misago.threads.models import Poll, Thread
 
 
 
 

+ 0 - 1
misago/threads/permissions/privatethreads.py

@@ -11,7 +11,6 @@ from misago.acl.models import Role
 from misago.categories import PRIVATE_THREADS_ROOT_NAME
 from misago.categories import PRIVATE_THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 
 
 
 

+ 0 - 1
misago/threads/permissions/threads.py

@@ -12,7 +12,6 @@ from misago.acl.models import Role
 from misago.categories.models import Category, CategoryRole, RoleCategoryACL
 from misago.categories.models import Category, CategoryRole, RoleCategoryACL
 from misago.categories.permissions import get_categories_roles
 from misago.categories.permissions import get_categories_roles
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 
 
 
 

+ 1 - 1
misago/threads/search.py

@@ -8,8 +8,8 @@ from misago.search import SearchProvider
 from .models import Post, Thread
 from .models import Post, Thread
 from .permissions import exclude_invisible_threads
 from .permissions import exclude_invisible_threads
 from .serializers import PostFeedSerializer
 from .serializers import PostFeedSerializer
-from .viewmodels import ThreadsRootCategory
 from .utils import add_categories_to_items
 from .utils import add_categories_to_items
+from .viewmodels import ThreadsRootCategory
 
 
 
 
 class SearchThreads(SearchProvider):
 class SearchThreads(SearchProvider):

+ 2 - 3
misago/threads/serializers/attachment.py

@@ -1,9 +1,8 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
-from misago.core.utils import format_plaintext_for_html
+from django.urls import reverse
 
 
+from misago.core.utils import format_plaintext_for_html
 from misago.threads.models import Attachment
 from misago.threads.models import Attachment
 
 
 
 

+ 2 - 3
misago/threads/serializers/moderation.py

@@ -1,10 +1,9 @@
+from rest_framework import serializers
+
 from django.core.exceptions import ValidationError
 from django.core.exceptions import ValidationError
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 
 
-from rest_framework import serializers
-
 from misago.acl import add_acl
 from misago.acl import add_acl
-
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 from misago.threads.permissions import can_start_thread
 from misago.threads.permissions import can_start_thread
 from misago.threads.validators import validate_category, validate_title
 from misago.threads.validators import validate_category, validate_title

+ 2 - 2
misago/threads/serializers/poll.py

@@ -1,10 +1,10 @@
+from rest_framework import serializers
+
 from django.urls import reverse
 from django.urls import reverse
 from django.utils.crypto import get_random_string
 from django.utils.crypto import get_random_string
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 from django.utils.translation import ungettext
 
 
-from rest_framework import serializers
-
 from misago.threads.models import Poll
 from misago.threads.models import Poll
 
 
 
 

+ 2 - 2
misago/threads/serializers/pollvote.py

@@ -1,7 +1,7 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
+from django.urls import reverse
+
 
 
 class PollVoteSerializer(serializers.Serializer):
 class PollVoteSerializer(serializers.Serializer):
     voted_on = serializers.DateTimeField()
     voted_on = serializers.DateTimeField()

+ 3 - 4
misago/threads/serializers/post.py

@@ -1,12 +1,11 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
+from django.urls import reverse
+
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.categories.serializers import BasicCategorySerializer
 from misago.categories.serializers import BasicCategorySerializer
-from misago.users.serializers import BasicUserSerializer, UserSerializer
-
 from misago.threads.models import Post
 from misago.threads.models import Post
+from misago.users.serializers import BasicUserSerializer, UserSerializer
 
 
 
 
 __all__ = [
 __all__ = [

+ 2 - 2
misago/threads/serializers/postedit.py

@@ -1,7 +1,7 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
+from django.urls import reverse
+
 from misago.threads.models import PostEdit
 from misago.threads.models import PostEdit
 
 
 
 

+ 2 - 2
misago/threads/serializers/postlike.py

@@ -1,7 +1,7 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
+from django.urls import reverse
+
 from misago.threads.models import PostLike
 from misago.threads.models import PostLike
 
 
 
 

+ 3 - 3
misago/threads/serializers/thread.py

@@ -1,10 +1,10 @@
-from django.urls import reverse
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
-from misago.categories.serializers import BasicCategorySerializer
+from django.urls import reverse
 
 
+from misago.categories.serializers import BasicCategorySerializer
 from misago.threads.models import Thread
 from misago.threads.models import Thread
+
 from .poll import PollSerializer
 from .poll import PollSerializer
 from .threadparticipant import ThreadParticipantSerializer
 from .threadparticipant import ThreadParticipantSerializer
 
 

+ 1 - 2
misago/threads/signals.py

@@ -8,8 +8,7 @@ from misago.categories.signals import delete_category_content, move_category_con
 from misago.core.pgutils import batch_delete, batch_update
 from misago.core.pgutils import batch_delete, batch_update
 from misago.users.signals import delete_user_content, username_changed
 from misago.users.signals import delete_user_content, username_changed
 
 
-from .models import (
-    Attachment, Poll, PollVote, Post, PostEdit, PostLike, Thread)
+from .models import Attachment, Poll, PollVote, Post, PostEdit, PostLike, Thread
 
 
 
 
 delete_post = Signal()
 delete_post = Signal()

+ 0 - 1
misago/threads/tests/test_attachmentadmin_views.py

@@ -2,7 +2,6 @@ from django.urls import reverse
 
 
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType
 
 

+ 1 - 2
misago/threads/tests/test_attachments_api.py

@@ -10,9 +10,8 @@ from django.utils.encoding import smart_str
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.conf import settings
 from misago.conf import settings
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 TESTFILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testfiles')
 TESTFILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testfiles')

+ 3 - 3
misago/threads/tests/test_attachments_middleware.py

@@ -3,12 +3,12 @@ from rest_framework import serializers
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.conf import settings
 from misago.conf import settings
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.api.postingendpoint import PostingEndpoint
 from misago.threads.api.postingendpoint import PostingEndpoint
-from misago.threads.api.postingendpoint.attachments import AttachmentsMiddleware, validate_attachments_count
+from misago.threads.api.postingendpoint.attachments import (
+    AttachmentsMiddleware, validate_attachments_count)
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class RequestMock(object):
 class RequestMock(object):

+ 0 - 1
misago/threads/tests/test_attachmenttypeadmin_views.py

@@ -2,7 +2,6 @@ from django.urls import reverse
 
 
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
-
 from misago.threads.models import AttachmentType
 from misago.threads.models import AttachmentType
 
 
 
 

+ 1 - 2
misago/threads/tests/test_attachmentview.py

@@ -6,10 +6,9 @@ from misago.acl.models import Role
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.conf import settings
 from misago.conf import settings
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 TESTFILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testfiles')
 TESTFILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testfiles')

+ 0 - 1
misago/threads/tests/test_clearattachments.py

@@ -7,7 +7,6 @@ from django.utils.six import StringIO
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.management.commands import clearattachments
 from misago.threads.management.commands import clearattachments
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType

+ 1 - 2
misago/threads/tests/test_emailnotification_middleware.py

@@ -12,9 +12,8 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 0 - 1
misago/threads/tests/test_events.py

@@ -7,7 +7,6 @@ from django.utils import timezone
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.events import record_event
 from misago.threads.events import record_event
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 from misago.threads.testutils import reply_thread
 from misago.threads.testutils import reply_thread

+ 1 - 2
misago/threads/tests/test_floodprotection.py

@@ -5,9 +5,8 @@ from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class PostMentionsTests(AuthenticatedUserTestCase):
 class PostMentionsTests(AuthenticatedUserTestCase):

+ 3 - 3
misago/threads/tests/test_floodprotection_middleware.py

@@ -3,10 +3,10 @@ from datetime import timedelta
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads.api.postingendpoint import PostingInterrupt
 from misago.threads.api.postingendpoint import PostingInterrupt
-from misago.threads.api.postingendpoint.floodprotection import MIN_POSTING_PAUSE, FloodProtectionMiddleware
+from misago.threads.api.postingendpoint.floodprotection import (
+    MIN_POSTING_PAUSE, FloodProtectionMiddleware)
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class FloodProtectionMiddlewareTests(AuthenticatedUserTestCase):
 class FloodProtectionMiddlewareTests(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_gotoviews.py

@@ -4,9 +4,8 @@ from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.conf import settings
 from misago.conf import settings
 from misago.readtracker.threadstracker import make_thread_read_aware, read_thread
 from misago.readtracker.threadstracker import make_thread_read_aware, read_thread
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 GOTO_URL = '%s#post-%s'
 GOTO_URL = '%s#post-%s'

+ 1 - 6
misago/threads/tests/test_participants.py

@@ -3,14 +3,9 @@ from django.test import TestCase
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.models import Post, Thread, ThreadParticipant
 from misago.threads.models import Post, Thread, ThreadParticipant
 from misago.threads.participants import (
 from misago.threads.participants import (
-    has_participants,
-    make_participants_aware,
-    set_owner,
-    set_users_unread_private_threads_sync
-)
+    has_participants, make_participants_aware, set_owner, set_users_unread_private_threads_sync)
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 2
misago/threads/tests/test_post_mentions.py

@@ -8,9 +8,8 @@ from django.urls import reverse
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.markup.mentions import MENTIONS_LIMIT
 from misago.markup.mentions import MENTIONS_LIMIT
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 0 - 1
misago/threads/tests/test_post_model.py

@@ -5,7 +5,6 @@ from django.test import TestCase
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.checksums import update_post_checksum
 from misago.threads.checksums import update_post_checksum
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 
 

+ 1 - 2
misago/threads/tests/test_posts_moderation.py

@@ -1,8 +1,7 @@
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import moderation, testutils
 from misago.threads import moderation, testutils
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class PostsModerationTests(AuthenticatedUserTestCase):
 class PostsModerationTests(AuthenticatedUserTestCase):

+ 1 - 1
misago/threads/tests/test_privatethread_patch_api.py

@@ -4,9 +4,9 @@ from django.contrib.auth import get_user_model
 from django.core import mail
 from django.core import mail
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Thread, ThreadParticipant
 from misago.threads.models import Thread, ThreadParticipant
+
 from .test_privatethreads import PrivateThreadsTestCase
 from .test_privatethreads import PrivateThreadsTestCase
 
 
 
 

+ 1 - 1
misago/threads/tests/test_privatethread_reply_api.py

@@ -1,9 +1,9 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import ThreadParticipant
 from misago.threads.models import ThreadParticipant
+
 from .test_privatethreads import PrivateThreadsTestCase
 from .test_privatethreads import PrivateThreadsTestCase
 
 
 
 

+ 1 - 2
misago/threads/tests/test_privatethread_start_api.py

@@ -10,9 +10,8 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads.models import Thread, ThreadParticipant
 from misago.threads.models import Thread, ThreadParticipant
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 1
misago/threads/tests/test_privatethread_view.py

@@ -1,7 +1,7 @@
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import ThreadParticipant
 from misago.threads.models import ThreadParticipant
+
 from .test_privatethreads import PrivateThreadsTestCase
 from .test_privatethreads import PrivateThreadsTestCase
 
 
 
 

+ 1 - 1
misago/threads/tests/test_privatethreads_api.py

@@ -1,9 +1,9 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Thread, ThreadParticipant
 from misago.threads.models import Thread, ThreadParticipant
+
 from .test_privatethreads import PrivateThreadsTestCase
 from .test_privatethreads import PrivateThreadsTestCase
 
 
 
 

+ 1 - 1
misago/threads/tests/test_privatethreads_lists.py

@@ -1,9 +1,9 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import ThreadParticipant
 from misago.threads.models import ThreadParticipant
+
 from .test_privatethreads import PrivateThreadsTestCase
 from .test_privatethreads import PrivateThreadsTestCase
 
 
 
 

+ 1 - 2
misago/threads/tests/test_search.py

@@ -1,9 +1,8 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class SearchApiTests(AuthenticatedUserTestCase):
 class SearchApiTests(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_subscription_middleware.py

@@ -6,9 +6,8 @@ from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 2
misago/threads/tests/test_subscriptions.py

@@ -6,10 +6,9 @@ from django.utils import timezone
 from django.utils.six.moves import range
 from django.utils.six.moves import range
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.models import AnonymousUser
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.subscriptions import make_subscription_aware
 from misago.threads.subscriptions import make_subscription_aware
+from misago.users.models import AnonymousUser
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 1 - 0
misago/threads/tests/test_sync_unread_private_threads.py

@@ -2,6 +2,7 @@ from django.contrib.auth import get_user_model
 
 
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import ThreadParticipant
 from misago.threads.models import ThreadParticipant
+
 from .test_privatethreads import PrivateThreadsTestCase
 from .test_privatethreads import PrivateThreadsTestCase
 
 
 
 

+ 0 - 1
misago/threads/tests/test_synchronizethreads.py

@@ -4,7 +4,6 @@ from django.utils.six import StringIO
 from django.utils.six.moves import range
 from django.utils.six.moves import range
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.management.commands import synchronizethreads
 from misago.threads.management.commands import synchronizethreads
 
 

+ 1 - 2
misago/threads/tests/test_thread_editreply_api.py

@@ -9,10 +9,9 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Thread
 from misago.threads.models import Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class EditReplyTests(AuthenticatedUserTestCase):
 class EditReplyTests(AuthenticatedUserTestCase):

+ 1 - 1
misago/threads/tests/test_thread_merge_api.py

@@ -5,9 +5,9 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Poll, PollVote, Thread
 from misago.threads.models import Poll, PollVote, Thread
+
 from .test_threads_api import ThreadsApiTestCase
 from .test_threads_api import ThreadsApiTestCase
 
 
 
 

+ 0 - 1
misago/threads/tests/test_thread_model.py

@@ -5,7 +5,6 @@ from django.test import TestCase
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.models import Poll, Post, Thread, ThreadParticipant
 from misago.threads.models import Poll, Post, Thread, ThreadParticipant
 
 
 
 

+ 1 - 1
misago/threads/tests/test_thread_patch_api.py

@@ -1,5 +1,5 @@
-from datetime import timedelta
 import json
 import json
+from datetime import timedelta
 
 
 from django.utils import six, timezone
 from django.utils import six, timezone
 
 

+ 1 - 2
misago/threads/tests/test_thread_poll_api.py

@@ -4,9 +4,8 @@ from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ThreadPollApiTestCase(AuthenticatedUserTestCase):
 class ThreadPollApiTestCase(AuthenticatedUserTestCase):

+ 1 - 0
misago/threads/tests/test_thread_pollcreate_api.py

@@ -2,6 +2,7 @@ from django.urls import reverse
 
 
 from misago.threads.models import Poll, Thread
 from misago.threads.models import Poll, Thread
 from misago.threads.serializers.poll import MAX_POLL_OPTIONS
 from misago.threads.serializers.poll import MAX_POLL_OPTIONS
+
 from .test_thread_poll_api import ThreadPollApiTestCase
 from .test_thread_poll_api import ThreadPollApiTestCase
 
 
 
 

+ 1 - 0
misago/threads/tests/test_thread_polldelete_api.py

@@ -4,6 +4,7 @@ from django.urls import reverse
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.threads.models import Poll, PollVote, Thread
 from misago.threads.models import Poll, PollVote, Thread
+
 from .test_thread_poll_api import ThreadPollApiTestCase
 from .test_thread_poll_api import ThreadPollApiTestCase
 
 
 
 

+ 1 - 0
misago/threads/tests/test_thread_polledit_api.py

@@ -4,6 +4,7 @@ from django.urls import reverse
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.threads.serializers.poll import MAX_POLL_OPTIONS
 from misago.threads.serializers.poll import MAX_POLL_OPTIONS
+
 from .test_thread_poll_api import ThreadPollApiTestCase
 from .test_thread_poll_api import ThreadPollApiTestCase
 
 
 
 

+ 1 - 0
misago/threads/tests/test_thread_pollvotes_api.py

@@ -5,6 +5,7 @@ from django.urls import reverse
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.threads.models import Poll
 from misago.threads.models import Poll
+
 from .test_thread_poll_api import ThreadPollApiTestCase
 from .test_thread_poll_api import ThreadPollApiTestCase
 
 
 
 

+ 1 - 0
misago/threads/tests/test_thread_postdelete_api.py

@@ -5,6 +5,7 @@ from django.utils import timezone
 
 
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
+
 from .test_threads_api import ThreadsApiTestCase
 from .test_threads_api import ThreadsApiTestCase
 
 
 
 

+ 1 - 1
misago/threads/tests/test_thread_postedits_api.py

@@ -8,9 +8,9 @@ from django.urls import reverse
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Post
 from misago.threads.models import Post
+
 from .test_threads_api import ThreadsApiTestCase
 from .test_threads_api import ThreadsApiTestCase
 
 
 
 

+ 1 - 0
misago/threads/tests/test_thread_postlikes_api.py

@@ -2,6 +2,7 @@ from django.urls import reverse
 
 
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.serializers import PostLikeSerializer
 from misago.threads.serializers import PostLikeSerializer
+
 from .test_threads_api import ThreadsApiTestCase
 from .test_threads_api import ThreadsApiTestCase
 
 
 
 

+ 1 - 2
misago/threads/tests/test_thread_postmerge_api.py

@@ -11,11 +11,10 @@ from django.utils.six.moves import range
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.api.postendpoints.merge import MERGE_LIMIT
 from misago.threads.api.postendpoints.merge import MERGE_LIMIT
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ThreadPostMergeApiTestCase(AuthenticatedUserTestCase):
 class ThreadPostMergeApiTestCase(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_thread_postmove_api.py

@@ -8,11 +8,10 @@ from django.utils.six.moves import range
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.api.postendpoints.move import MOVE_LIMIT
 from misago.threads.api.postendpoints.move import MOVE_LIMIT
 from misago.threads.models import Thread
 from misago.threads.models import Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ThreadPostMoveApiTestCase(AuthenticatedUserTestCase):
 class ThreadPostMoveApiTestCase(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_thread_postpatch_api.py

@@ -9,10 +9,9 @@ from django.utils import timezone
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ThreadPostPatchApiTestCase(AuthenticatedUserTestCase):
 class ThreadPostPatchApiTestCase(AuthenticatedUserTestCase):

+ 1 - 1
misago/threads/tests/test_thread_postread_api.py

@@ -3,6 +3,7 @@ from django.utils import timezone
 
 
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
+
 from .test_threads_api import ThreadsApiTestCase
 from .test_threads_api import ThreadsApiTestCase
 
 
 
 
@@ -61,4 +62,3 @@ class PostReadApiTests(ThreadsApiTestCase):
 
 
         subscription = self.thread.subscription_set.order_by('id').last()
         subscription = self.thread.subscription_set.order_by('id').last()
         self.assertEqual(subscription.last_read_on, self.post.posted_on)
         self.assertEqual(subscription.last_read_on, self.post.posted_on)
-

+ 1 - 2
misago/threads/tests/test_thread_postsplit_api.py

@@ -9,11 +9,10 @@ from django.utils.six.moves import range
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.api.postendpoints.split import SPLIT_LIMIT
 from misago.threads.api.postendpoints.split import SPLIT_LIMIT
 from misago.threads.models import Thread
 from misago.threads.models import Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
 class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_thread_reply_api.py

@@ -8,10 +8,9 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Thread
 from misago.threads.models import Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ReplyThreadTests(AuthenticatedUserTestCase):
 class ReplyThreadTests(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_thread_start_api.py

@@ -6,10 +6,9 @@ from django.urls import reverse
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class StartThreadTests(AuthenticatedUserTestCase):
 class StartThreadTests(AuthenticatedUserTestCase):

+ 0 - 1
misago/threads/tests/test_threadparticipant_model.py

@@ -3,7 +3,6 @@ from django.test import TestCase
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.models import Post, Thread, ThreadParticipant
 from misago.threads.models import Post, Thread, ThreadParticipant
 
 
 
 

+ 1 - 2
misago/threads/tests/test_threads_api.py

@@ -3,11 +3,10 @@ from django.urls import reverse
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 from misago.threads.threadtypes import trees_map
 from misago.threads.threadtypes import trees_map
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class ThreadsApiTestCase(AuthenticatedUserTestCase):
 class ThreadsApiTestCase(AuthenticatedUserTestCase):

+ 1 - 2
misago/threads/tests/test_threads_editor_api.py

@@ -7,11 +7,10 @@ from django.utils.encoding import smart_str
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.models import Attachment
 from misago.threads.models import Attachment
 from misago.threads.serializers import AttachmentSerializer
 from misago.threads.serializers import AttachmentSerializer
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 TESTFILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testfiles')
 TESTFILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testfiles')

+ 1 - 1
misago/threads/tests/test_threads_merge_api.py

@@ -6,11 +6,11 @@ from django.utils.six.moves import range
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.api.threadendpoints.merge import MERGE_LIMIT
 from misago.threads.api.threadendpoints.merge import MERGE_LIMIT
 from misago.threads.models import Poll, PollVote, Post, Thread
 from misago.threads.models import Poll, PollVote, Post, Thread
 from misago.threads.serializers import ThreadsListSerializer
 from misago.threads.serializers import ThreadsListSerializer
+
 from .test_threads_api import ThreadsApiTestCase
 from .test_threads_api import ThreadsApiTestCase
 
 
 
 

+ 1 - 2
misago/threads/tests/test_threads_moderation.py

@@ -1,8 +1,7 @@
 from misago.categories.models import Category
 from misago.categories.models import Category
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import moderation, testutils
 from misago.threads import moderation, testutils
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class MockRequest(object):
 class MockRequest(object):

+ 1 - 2
misago/threads/tests/test_threadslists.py

@@ -12,11 +12,10 @@ from misago.conf import settings
 from misago.core import threadstore
 from misago.core import threadstore
 from misago.core.cache import cache
 from misago.core.cache import cache
 from misago.readtracker import categoriestracker, threadstracker
 from misago.readtracker import categoriestracker, threadstracker
+from misago.threads import testutils
 from misago.users.models import AnonymousUser
 from misago.users.models import AnonymousUser
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
-from misago.threads import testutils
-
 
 
 LISTS_URLS = (
 LISTS_URLS = (
     '',
     '',

+ 1 - 2
misago/threads/tests/test_threadview.py

@@ -1,13 +1,12 @@
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.conf import settings
 from misago.conf import settings
-from misago.users.testutils import AuthenticatedUserTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.events import record_event
 from misago.threads.events import record_event
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 from misago.threads.moderation import threads as threads_moderation
 from misago.threads.moderation import threads as threads_moderation
 from misago.threads.moderation.posts import hide_post
 from misago.threads.moderation.posts import hide_post
+from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 
 class MockRequest(object):
 class MockRequest(object):

+ 0 - 1
misago/threads/tests/test_treesmap.py

@@ -2,7 +2,6 @@ from django.test import TestCase
 from django.utils import six
 from django.utils import six
 
 
 from misago.categories.models import Category
 from misago.categories.models import Category
-
 from misago.threads.threadtypes.treesmap import TreesMap
 from misago.threads.threadtypes.treesmap import TreesMap
 
 
 
 

+ 0 - 1
misago/threads/tests/test_utils.py

@@ -1,6 +1,5 @@
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.core.testutils import MisagoTestCase
 from misago.core.testutils import MisagoTestCase
-
 from misago.threads import testutils
 from misago.threads import testutils
 from misago.threads.utils import add_categories_to_items, get_thread_id_from_url
 from misago.threads.utils import add_categories_to_items, get_thread_id_from_url
 
 

+ 0 - 1
misago/threads/tests/test_validators.py

@@ -2,7 +2,6 @@ from django.core.exceptions import ValidationError
 from django.test import TestCase
 from django.test import TestCase
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads.validators import validate_post, validate_title
 from misago.threads.validators import validate_post, validate_title
 
 
 
 

+ 0 - 1
misago/threads/urls/api.py

@@ -1,5 +1,4 @@
 from misago.core.apirouter import MisagoApiRouter
 from misago.core.apirouter import MisagoApiRouter
-
 from misago.threads.api.attachments import AttachmentViewSet
 from misago.threads.api.attachments import AttachmentViewSet
 from misago.threads.api.threadpoll import ThreadPollViewSet
 from misago.threads.api.threadpoll import ThreadPollViewSet
 from misago.threads.api.threadposts import PrivateThreadPostsViewSet, ThreadPostsViewSet
 from misago.threads.api.threadposts import PrivateThreadPostsViewSet, ThreadPostsViewSet

+ 0 - 1
misago/threads/viewmodels/category.py

@@ -6,7 +6,6 @@ from misago.categories.permissions import allow_browse_category, allow_see_categ
 from misago.categories.serializers import BasicCategorySerializer
 from misago.categories.serializers import BasicCategorySerializer
 from misago.core.shortcuts import validate_slug
 from misago.core.shortcuts import validate_slug
 from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.core.viewmodel import ViewModel as BaseViewModel
-
 from misago.threads.permissions import allow_use_private_threads
 from misago.threads.permissions import allow_use_private_threads
 
 
 
 

+ 0 - 1
misago/threads/viewmodels/post.py

@@ -2,7 +2,6 @@ from django.shortcuts import get_object_or_404
 
 
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.core.viewmodel import ViewModel as BaseViewModel
-
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.permissions.threads import exclude_invisible_posts
 
 
 
 

+ 1 - 2
misago/threads/viewmodels/posts.py

@@ -2,12 +2,11 @@ from misago.acl import add_acl
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.readtracker.threadstracker import make_posts_read_aware
 from misago.readtracker.threadstracker import make_posts_read_aware
-from misago.users.online.utils import make_users_status_aware
-
 from misago.threads.paginator import PostsPaginator
 from misago.threads.paginator import PostsPaginator
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.serializers import PostSerializer
 from misago.threads.serializers import PostSerializer
 from misago.threads.utils import add_likes_to_posts
 from misago.threads.utils import add_likes_to_posts
+from misago.users.online.utils import make_users_status_aware
 
 
 
 
 __all__ = ['ThreadPosts']
 __all__ = ['ThreadPosts']

+ 2 - 2
misago/threads/viewmodels/thread.py

@@ -7,10 +7,10 @@ from misago.categories.models import Category
 from misago.core.shortcuts import validate_slug
 from misago.core.shortcuts import validate_slug
 from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.readtracker.threadstracker import make_read_aware
 from misago.readtracker.threadstracker import make_read_aware
-
 from misago.threads.models import Poll, Thread
 from misago.threads.models import Poll, Thread
 from misago.threads.participants import make_participants_aware
 from misago.threads.participants import make_participants_aware
-from misago.threads.permissions.privatethreads import allow_use_private_threads, allow_see_private_thread
+from misago.threads.permissions.privatethreads import (
+    allow_see_private_thread, allow_use_private_threads)
 from misago.threads.permissions.threads import allow_see_thread
 from misago.threads.permissions.threads import allow_see_thread
 from misago.threads.serializers import PrivateThreadSerializer, ThreadSerializer
 from misago.threads.serializers import PrivateThreadSerializer, ThreadSerializer
 from misago.threads.subscriptions import make_subscription_aware
 from misago.threads.subscriptions import make_subscription_aware

+ 0 - 1
misago/threads/viewmodels/threads.py

@@ -11,7 +11,6 @@ from misago.acl import add_acl
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.readtracker import threadstracker
 from misago.readtracker import threadstracker
-
 from misago.threads.models import Thread
 from misago.threads.models import Thread
 from misago.threads.participants import make_participants_aware
 from misago.threads.participants import make_participants_aware
 from misago.threads.permissions import exclude_invisible_threads
 from misago.threads.permissions import exclude_invisible_threads

+ 0 - 1
misago/threads/views/admin/attachments.py

@@ -6,7 +6,6 @@ from django.urls import reverse
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from misago.admin.views import generic
 from misago.admin.views import generic
-
 from misago.threads.forms import SearchAttachmentsForm
 from misago.threads.forms import SearchAttachmentsForm
 from misago.threads.models import Attachment, Post
 from misago.threads.models import Attachment, Post
 
 

+ 0 - 1
misago/threads/views/admin/attachmenttypes.py

@@ -5,7 +5,6 @@ from django.urls import reverse
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from misago.admin.views import generic
 from misago.admin.views import generic
-
 from misago.threads.forms import AttachmentTypeForm
 from misago.threads.forms import AttachmentTypeForm
 from misago.threads.models import AttachmentType
 from misago.threads.models import AttachmentType
 
 

+ 0 - 1
misago/threads/views/attachment.py

@@ -8,7 +8,6 @@ from django.http import Http404
 from django.shortcuts import get_object_or_404, redirect
 from django.shortcuts import get_object_or_404, redirect
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads.models import Attachment, AttachmentType
 from misago.threads.models import Attachment, AttachmentType
 
 
 
 

+ 0 - 1
misago/threads/views/goto.py

@@ -6,7 +6,6 @@ from django.utils.translation import ugettext as _
 from django.views.generic import View
 from django.views.generic import View
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.permissions.threads import exclude_invisible_posts
 from misago.threads.viewmodels import ForumThread, PrivateThread
 from misago.threads.viewmodels import ForumThread, PrivateThread
 
 

+ 2 - 2
misago/threads/views/list.py

@@ -5,8 +5,8 @@ from django.urls import reverse
 from django.views.generic import View
 from django.views.generic import View
 
 
 from misago.core.shortcuts import get_int_or_404
 from misago.core.shortcuts import get_int_or_404
-
-from misago.threads.viewmodels import ForumThreads, PrivateThreads, PrivateThreadsCategory, ThreadsCategory, ThreadsRootCategory
+from misago.threads.viewmodels import (
+    ForumThreads, PrivateThreads, PrivateThreadsCategory, ThreadsCategory, ThreadsRootCategory)
 
 
 
 
 class ListBase(View):
 class ListBase(View):

+ 2 - 3
misago/users/admin.py

@@ -2,11 +2,10 @@ from django.conf.urls import url
 from django.contrib import admin as djadmin
 from django.contrib import admin as djadmin
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
-from .djangoadmin import UserModel, UserAdmin
+from .djangoadmin import UserAdmin, UserModel
 from .views.admin.bans import BansList, DeleteBan, EditBan, NewBan
 from .views.admin.bans import BansList, DeleteBan, EditBan, NewBan
 from .views.admin.ranks import (
 from .views.admin.ranks import (
-    DefaultRank, DeleteRank, EditRank, MoveDownRank, MoveUpRank, NewRank,
-    RanksList, RankUsers)
+    DefaultRank, DeleteRank, EditRank, MoveDownRank, MoveUpRank, NewRank, RanksList, RankUsers)
 from .views.admin.users import (
 from .views.admin.users import (
     DeleteAccountStep, DeletePostsStep, DeleteThreadsStep, EditUser, NewUser, UsersList)
     DeleteAccountStep, DeletePostsStep, DeleteThreadsStep, EditUser, NewUser, UsersList)
 
 

+ 7 - 6
misago/users/api/auth.py

@@ -1,20 +1,21 @@
+from rest_framework import status
+from rest_framework.decorators import api_view, permission_classes
+from rest_framework.response import Response
+
 from django.contrib import auth
 from django.contrib import auth
 from django.contrib.auth.password_validation import validate_password
 from django.contrib.auth.password_validation import validate_password
 from django.core.exceptions import ValidationError
 from django.core.exceptions import ValidationError
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.views.decorators.csrf import csrf_protect
 from django.views.decorators.csrf import csrf_protect
 
 
-from rest_framework import status
-from rest_framework.decorators import api_view, permission_classes
-from rest_framework.response import Response
-
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.mail import mail_user
 from misago.core.mail import mail_user
-
 from misago.users.bans import get_user_ban
 from misago.users.bans import get_user_ban
 from misago.users.forms.auth import AuthenticationForm, ResendActivationForm, ResetPasswordForm
 from misago.users.forms.auth import AuthenticationForm, ResendActivationForm, ResetPasswordForm
 from misago.users.serializers import AnonymousUserSerializer, AuthenticatedUserSerializer
 from misago.users.serializers import AnonymousUserSerializer, AuthenticatedUserSerializer
-from misago.users.tokens import is_password_change_token_valid, make_activation_token, make_password_change_token
+from misago.users.tokens import (
+    is_password_change_token_valid, make_activation_token, make_password_change_token)
+
 from .rest_permissions import UnbannedAnonOnly, UnbannedOnly
 from .rest_permissions import UnbannedAnonOnly, UnbannedOnly
 
 
 
 

+ 2 - 2
misago/users/api/captcha.py

@@ -1,8 +1,8 @@
-from django.http import Http404
-
 from rest_framework.decorators import api_view
 from rest_framework.decorators import api_view
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.http import Http404
+
 from misago.conf import settings
 from misago.conf import settings
 
 
 
 

+ 2 - 3
misago/users/api/rest_permissions.py

@@ -1,10 +1,9 @@
+from rest_framework.permissions import BasePermission
+
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
-from rest_framework.permissions import BasePermission
-
 from misago.core.exceptions import Banned
 from misago.core.exceptions import Banned
-
 from misago.users.bans import get_request_ip_ban
 from misago.users.bans import get_request_ip_ban
 from misago.users.models import Ban
 from misago.users.models import Ban
 
 

+ 3 - 4
misago/users/api/userendpoints/avatar.py

@@ -1,14 +1,13 @@
 import json
 import json
 
 
-from django.core.exceptions import PermissionDenied, ValidationError
-from django.utils.translation import ugettext as _
-
 from rest_framework import status
 from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.core.exceptions import PermissionDenied, ValidationError
+from django.utils.translation import ugettext as _
+
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.utils import format_plaintext_for_html
 from misago.core.utils import format_plaintext_for_html
-
 from misago.users import avatars
 from misago.users import avatars
 from misago.users.forms.moderation import ModerateAvatarForm
 from misago.users.forms.moderation import ModerateAvatarForm
 from misago.users.models import AvatarGallery
 from misago.users.models import AvatarGallery

+ 2 - 3
misago/users/api/userendpoints/changeemail.py

@@ -1,11 +1,10 @@
-from django.utils.translation import ugettext as _
-
 from rest_framework import status
 from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.utils.translation import ugettext as _
+
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.mail import mail_user
 from misago.core.mail import mail_user
-
 from misago.users.credentialchange import store_new_credential
 from misago.users.credentialchange import store_new_credential
 from misago.users.forms.options import ChangeEmailForm
 from misago.users.forms.options import ChangeEmailForm
 
 

+ 2 - 3
misago/users/api/userendpoints/changepassword.py

@@ -1,11 +1,10 @@
-from django.utils.translation import ugettext as _
-
 from rest_framework import status
 from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.utils.translation import ugettext as _
+
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.mail import mail_user
 from misago.core.mail import mail_user
-
 from misago.users.credentialchange import store_new_credential
 from misago.users.credentialchange import store_new_credential
 from misago.users.forms.options import ChangePasswordForm
 from misago.users.forms.options import ChangePasswordForm
 
 

+ 3 - 4
misago/users/api/userendpoints/create.py

@@ -1,14 +1,13 @@
+from rest_framework import status
+from rest_framework.response import Response
+
 from django.contrib.auth import authenticate, get_user_model, login
 from django.contrib.auth import authenticate, get_user_model, login
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 from django.views.decorators.csrf import csrf_protect
 from django.views.decorators.csrf import csrf_protect
 
 
-from rest_framework import status
-from rest_framework.response import Response
-
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.mail import mail_user
 from misago.core.mail import mail_user
-
 from misago.users import captcha
 from misago.users import captcha
 from misago.users.forms.register import RegisterForm
 from misago.users.forms.register import RegisterForm
 from misago.users.serializers import AuthenticatedUserSerializer
 from misago.users.serializers import AuthenticatedUserSerializer

+ 3 - 5
misago/users/api/userendpoints/list.py

@@ -1,17 +1,15 @@
 from datetime import timedelta
 from datetime import timedelta
 
 
+from rest_framework.response import Response
+
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.db.models import Count
 from django.db.models import Count
 from django.http import Http404
 from django.http import Http404
 from django.utils import timezone
 from django.utils import timezone
 
 
-from rest_framework.response import Response
-
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.cache import cache
 from misago.core.cache import cache
-from misago.core.shortcuts import (
-    get_int_or_404, get_object_or_404, paginate, paginated_response)
-
+from misago.core.shortcuts import get_int_or_404, get_object_or_404, paginate, paginated_response
 from misago.users.activepostersranking import get_active_posters_ranking
 from misago.users.activepostersranking import get_active_posters_ranking
 from misago.users.models import Rank
 from misago.users.models import Rank
 from misago.users.online.utils import make_users_status_aware
 from misago.users.online.utils import make_users_status_aware

+ 3 - 4
misago/users/api/userendpoints/signature.py

@@ -1,12 +1,11 @@
-from django.core.exceptions import PermissionDenied
-from django.utils.translation import ugettext as _
-
 from rest_framework import status
 from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
+from django.core.exceptions import PermissionDenied
+from django.utils.translation import ugettext as _
+
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.utils import format_plaintext_for_html
 from misago.core.utils import format_plaintext_for_html
-
 from misago.users.forms.options import EditSignatureForm
 from misago.users.forms.options import EditSignatureForm
 from misago.users.signatures import is_user_signature_valid, set_user_signature
 from misago.users.signatures import is_user_signature_valid, set_user_signature
 
 

+ 3 - 4
misago/users/api/userendpoints/username.py

@@ -1,11 +1,10 @@
-from django.db import IntegrityError
-from django.utils.translation import ugettext as _
-
 from rest_framework import status
 from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
-from misago.conf import settings
+from django.db import IntegrityError
+from django.utils.translation import ugettext as _
 
 
+from misago.conf import settings
 from misago.users.forms.rename import ChangeUsernameForm
 from misago.users.forms.rename import ChangeUsernameForm
 from misago.users.namechanges import UsernameChanges
 from misago.users.namechanges import UsernameChanges
 
 

+ 5 - 6
misago/users/api/usernamechanges.py

@@ -1,16 +1,15 @@
+from rest_framework import mixins, status, viewsets
+from rest_framework.response import Response
+
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db.models import Q
 from django.db.models import Q
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
-from rest_framework import mixins, status, viewsets
-from rest_framework.response import Response
-
-from misago.core.shortcuts import (
-    get_int_or_404, get_object_or_404, paginate, pagination_dict)
-
+from misago.core.shortcuts import get_int_or_404, get_object_or_404, paginate, pagination_dict
 from misago.users.models import UsernameChange
 from misago.users.models import UsernameChange
 from misago.users.serializers.usernamechange import UsernameChangeSerializer
 from misago.users.serializers.usernamechange import UsernameChangeSerializer
+
 from .rest_permissions import BasePermission
 from .rest_permissions import BasePermission
 
 
 
 

+ 8 - 7
misago/users/api/users.py

@@ -1,3 +1,8 @@
+from rest_framework import mixins, status, viewsets
+from rest_framework.decorators import detail_route, list_route
+from rest_framework.parsers import FormParser, JSONParser, MultiPartParser
+from rest_framework.response import Response
+
 from django.conf import settings
 from django.conf import settings
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
@@ -6,11 +11,6 @@ from django.db.models import F
 from django.http import Http404
 from django.http import Http404
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
-from rest_framework import mixins, status, viewsets
-from rest_framework.decorators import detail_route, list_route
-from rest_framework.parsers import FormParser, JSONParser, MultiPartParser
-from rest_framework.response import Response
-
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.core.cache import cache
 from misago.core.cache import cache
@@ -18,15 +18,16 @@ from misago.core.rest_permissions import IsAuthenticatedOrReadOnly
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.core.shortcuts import get_int_or_404, get_object_or_404
 from misago.threads.moderation.posts import hide_post
 from misago.threads.moderation.posts import hide_post
 from misago.threads.moderation.threads import hide_thread
 from misago.threads.moderation.threads import hide_thread
-
 from misago.users.bans import get_user_ban
 from misago.users.bans import get_user_ban
 from misago.users.forms.options import ForumOptionsForm
 from misago.users.forms.options import ForumOptionsForm
 from misago.users.online.utils import get_user_status
 from misago.users.online.utils import get_user_status
 from misago.users.permissions.delete import allow_delete_user
 from misago.users.permissions.delete import allow_delete_user
 from misago.users.permissions.moderation import allow_moderate_avatar, allow_rename_user
 from misago.users.permissions.moderation import allow_moderate_avatar, allow_rename_user
-from misago.users.permissions.profiles import allow_browse_users_list, allow_follow_user, allow_see_ban_details
+from misago.users.permissions.profiles import (
+    allow_browse_users_list, allow_follow_user, allow_see_ban_details)
 from misago.users.serializers import BanDetailsSerializer, UserProfileSerializer, UserSerializer
 from misago.users.serializers import BanDetailsSerializer, UserProfileSerializer, UserSerializer
 from misago.users.viewmodels import UserPosts, UserThreads
 from misago.users.viewmodels import UserPosts, UserThreads
+
 from .rest_permissions import BasePermission, UnbannedAnonOnly
 from .rest_permissions import BasePermission, UnbannedAnonOnly
 from .userendpoints.avatar import avatar_endpoint, moderate_avatar_endpoint
 from .userendpoints.avatar import avatar_endpoint, moderate_avatar_endpoint
 from .userendpoints.changeemail import change_email_endpoint
 from .userendpoints.changeemail import change_email_endpoint

+ 0 - 1
misago/users/forms/admin.py

@@ -9,7 +9,6 @@ from misago.conf import settings
 from misago.core import threadstore
 from misago.core import threadstore
 from misago.core.forms import IsoDateTimeField, YesNoSwitch
 from misago.core.forms import IsoDateTimeField, YesNoSwitch
 from misago.core.validators import validate_sluggable
 from misago.core.validators import validate_sluggable
-
 from misago.users.models import Ban, Rank
 from misago.users.models import Ban, Rank
 from misago.users.validators import validate_email, validate_username
 from misago.users.validators import validate_email, validate_username
 
 

+ 0 - 1
misago/users/forms/moderation.py

@@ -8,7 +8,6 @@ from django.utils.translation import ungettext
 
 
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.users.bans import ban_user
 from misago.users.bans import ban_user
 
 
 
 

+ 0 - 1
misago/users/forms/options.py

@@ -6,7 +6,6 @@ from django.utils.translation import ungettext
 
 
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.users.validators import validate_email
 from misago.users.validators import validate_email
 
 
 
 

+ 0 - 1
misago/users/management/commands/buildactivepostersranking.py

@@ -1,7 +1,6 @@
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
 
 
 from misago.core.management.progressbar import show_progress
 from misago.core.management.progressbar import show_progress
-
 from misago.users.activepostersranking import build_active_posters_ranking
 from misago.users.activepostersranking import build_active_posters_ranking
 
 
 
 

+ 0 - 1
misago/users/management/commands/invalidatebans.py

@@ -2,7 +2,6 @@ from django.core.management.base import BaseCommand
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.core import cachebuster
 from misago.core import cachebuster
-
 from misago.users.models import Ban, BanCache
 from misago.users.models import Ban, BanCache
 
 
 
 

+ 0 - 1
misago/users/management/commands/loadavatargallery.py

@@ -1,7 +1,6 @@
 from django.core.management.base import BaseCommand
 from django.core.management.base import BaseCommand
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.users.avatars.gallery import load_avatar_galleries
 from misago.users.avatars.gallery import load_avatar_galleries
 from misago.users.models import AvatarGallery
 from misago.users.models import AvatarGallery
 
 

+ 2 - 2
misago/users/middleware.py

@@ -1,9 +1,9 @@
-import pytz
-
 from django.contrib.auth import logout
 from django.contrib.auth import logout
 from django.contrib.auth.models import AnonymousUser as DjAnonymousUser
 from django.contrib.auth.models import AnonymousUser as DjAnonymousUser
 from django.utils.deprecation import MiddlewareMixin
 from django.utils.deprecation import MiddlewareMixin
 
 
+import pytz
+
 from .bans import get_request_ip_ban, get_user_ban
 from .bans import get_request_ip_ban, get_user_ban
 from .models import AnonymousUser, Online
 from .models import AnonymousUser, Online
 from .online import tracker
 from .online import tracker

+ 3 - 3
misago/users/migrations/0001_initial.py

@@ -1,14 +1,14 @@
 # -*- coding: utf-8 -*-
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 from __future__ import unicode_literals
 
 
+import django.db.models.deletion
+import django.utils.timezone
 from django.conf import settings
 from django.conf import settings
 from django.contrib.postgres.fields import JSONField
 from django.contrib.postgres.fields import JSONField
 from django.db import migrations, models
 from django.db import migrations, models
-import django.db.models.deletion
-import django.utils.timezone
 
 
-from misago.core.pgutils import CreatePartialIndex
 import misago.users.avatars.store
 import misago.users.avatars.store
+from misago.core.pgutils import CreatePartialIndex
 
 
 
 
 class Migration(migrations.Migration):
 class Migration(migrations.Migration):

+ 0 - 1
misago/users/migrations/0003_bans_version_tracker.py

@@ -4,7 +4,6 @@ from __future__ import unicode_literals
 from django.db import migrations, models
 from django.db import migrations, models
 
 
 from misago.core.migrationutils import cachebuster_register_cache
 from misago.core.migrationutils import cachebuster_register_cache
-
 from misago.users.constants import BANS_CACHEBUSTER
 from misago.users.constants import BANS_CACHEBUSTER
 
 
 
 

+ 1 - 1
misago/users/migrations/0006_update_settings.py

@@ -4,7 +4,7 @@ from __future__ import unicode_literals
 
 
 from django.db import migrations
 from django.db import migrations
 
 
-from misago.conf.migrationutils import migrate_settings_group, delete_settings_cache
+from misago.conf.migrationutils import delete_settings_cache, migrate_settings_group
 
 
 
 
 _ = lambda x: x
 _ = lambda x: x

+ 0 - 1
misago/users/models/ban.py

@@ -6,7 +6,6 @@ from django.utils import timezone
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from misago.core import cachebuster
 from misago.core import cachebuster
-
 from misago.users.constants import BANS_CACHEBUSTER
 from misago.users.constants import BANS_CACHEBUSTER
 
 
 
 

+ 2 - 2
misago/users/models/user.py

@@ -1,8 +1,8 @@
 from hashlib import md5
 from hashlib import md5
 
 
 from django.contrib.auth.models import AnonymousUser as DjangoAnonymousUser
 from django.contrib.auth.models import AnonymousUser as DjangoAnonymousUser
-from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
 from django.contrib.auth.models import UserManager as BaseUserManager
 from django.contrib.auth.models import UserManager as BaseUserManager
+from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
 from django.contrib.auth.password_validation import validate_password
 from django.contrib.auth.password_validation import validate_password
 from django.contrib.postgres.fields import JSONField
 from django.contrib.postgres.fields import JSONField
 from django.core.mail import send_mail
 from django.core.mail import send_mail
@@ -16,10 +16,10 @@ from misago.acl import get_user_acl
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.utils import slugify
 from misago.core.utils import slugify
-
 from misago.users import avatars
 from misago.users import avatars
 from misago.users.signatures import is_user_signature_valid, make_signature_checksum
 from misago.users.signatures import is_user_signature_valid, make_signature_checksum
 from misago.users.utils import hash_email
 from misago.users.utils import hash_email
+
 from .rank import Rank
 from .rank import Rank
 
 
 
 

+ 0 - 1
misago/users/permissions/moderation.py

@@ -11,7 +11,6 @@ from misago.acl import algebra
 from misago.acl.decorators import return_boolean
 from misago.acl.decorators import return_boolean
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.core.forms import YesNoSwitch
 from misago.core.forms import YesNoSwitch
-
 from misago.users.bans import get_user_ban
 from misago.users.bans import get_user_ban
 
 
 
 

+ 2 - 1
misago/users/search.py

@@ -1,6 +1,7 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
-from django.utils.translation import ugettext as _, ugettext_lazy
+from django.utils.translation import ugettext as _
+from django.utils.translation import ugettext_lazy
 
 
 from misago.search import SearchProvider
 from misago.search import SearchProvider
 
 

+ 2 - 3
misago/users/serializers/ban.py

@@ -1,9 +1,8 @@
-from django.utils.translation import ugettext as _
-
 from rest_framework import serializers
 from rest_framework import serializers
 
 
-from misago.core.utils import format_plaintext_for_html
+from django.utils.translation import ugettext as _
 
 
+from misago.core.utils import format_plaintext_for_html
 from misago.users.models import Ban
 from misago.users.models import Ban
 
 
 
 

+ 0 - 1
misago/users/serializers/rank.py

@@ -1,7 +1,6 @@
 from rest_framework import serializers
 from rest_framework import serializers
 
 
 from misago.core.utils import format_plaintext_for_html
 from misago.core.utils import format_plaintext_for_html
-
 from misago.users.models import Rank
 from misago.users.models import Rank
 
 
 
 

+ 2 - 2
misago/users/serializers/user.py

@@ -1,8 +1,8 @@
+from rest_framework import serializers
+
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.urls import reverse
 from django.urls import reverse
 
 
-from rest_framework import serializers
-
 from misago.acl import serialize_acl
 from misago.acl import serialize_acl
 
 
 from . import RankSerializer
 from . import RankSerializer

+ 1 - 0
misago/users/serializers/usernamechange.py

@@ -1,6 +1,7 @@
 from rest_framework import serializers
 from rest_framework import serializers
 
 
 from misago.users.models import UsernameChange
 from misago.users.models import UsernameChange
+
 from .user import BasicUserSerializer
 from .user import BasicUserSerializer
 
 
 
 

+ 0 - 1
misago/users/templatetags/misago_avatars.py

@@ -14,4 +14,3 @@ def avatar(user, size=200):
         if user_avatar['size'] >= size:
         if user_avatar['size'] >= size:
             found_avatar = user_avatar
             found_avatar = user_avatar
     return found_avatar['url']
     return found_avatar['url']
-

+ 0 - 1
misago/users/tests/test_activation_views.py

@@ -3,7 +3,6 @@ from django.test import TestCase
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.core.utils import encode_json_html
 from misago.core.utils import encode_json_html
-
 from misago.users.models import Ban
 from misago.users.models import Ban
 from misago.users.tokens import make_activation_token
 from misago.users.tokens import make_activation_token
 
 

+ 2 - 2
misago/users/tests/test_activepostersranking.py

@@ -4,8 +4,8 @@ from misago.categories.models import Category
 from misago.core import threadstore
 from misago.core import threadstore
 from misago.core.cache import cache
 from misago.core.cache import cache
 from misago.threads.testutils import post_thread
 from misago.threads.testutils import post_thread
-
-from misago.users.activepostersranking import build_active_posters_ranking, get_active_posters_ranking
+from misago.users.activepostersranking import (
+    build_active_posters_ranking, get_active_posters_ranking)
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 

+ 1 - 3
misago/users/tests/test_avatars.py

@@ -7,9 +7,7 @@ from django.test import TestCase, override_settings
 from django.utils.crypto import get_random_string
 from django.utils.crypto import get_random_string
 
 
 from misago.conf import settings
 from misago.conf import settings
-
-from misago.users.avatars import (
-    set_default_avatar, dynamic, gallery, gravatar, store, uploaded)
+from misago.users.avatars import dynamic, gallery, gravatar, set_default_avatar, store, uploaded
 from misago.users.models import Avatar, AvatarGallery
 from misago.users.models import Avatar, AvatarGallery
 
 
 
 

+ 0 - 1
misago/users/tests/test_banadmin_views.py

@@ -4,7 +4,6 @@ from django.urls import reverse
 from django.utils.six.moves import range
 from django.utils.six.moves import range
 
 
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
-
 from misago.users.models import Ban
 from misago.users.models import Ban
 
 
 
 

+ 1 - 2
misago/users/tests/test_bans.py

@@ -5,8 +5,7 @@ from django.test import TestCase
 from django.utils import timezone
 from django.utils import timezone
 
 
 from misago.users.bans import (
 from misago.users.bans import (
-    ban_ip, ban_user, get_email_ban, get_ip_ban,
-    get_request_ip_ban, get_user_ban, get_username_ban)
+    ban_ip, ban_user, get_email_ban, get_ip_ban, get_request_ip_ban, get_user_ban, get_username_ban)
 from misago.users.models import Ban
 from misago.users.models import Ban
 
 
 
 

+ 0 - 1
misago/users/tests/test_decorators.py

@@ -1,7 +1,6 @@
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.core.utils import encode_json_html
 from misago.core.utils import encode_json_html
-
 from misago.users.models import Ban
 from misago.users.models import Ban
 from misago.users.testutils import UserTestCase
 from misago.users.testutils import UserTestCase
 
 

+ 0 - 1
misago/users/tests/test_forgottenpassword_views.py

@@ -2,7 +2,6 @@ from django.contrib.auth import get_user_model
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.core.utils import encode_json_html
 from misago.core.utils import encode_json_html
-
 from misago.users.models import Ban
 from misago.users.models import Ban
 from misago.users.testutils import UserTestCase
 from misago.users.testutils import UserTestCase
 from misago.users.tokens import make_password_change_token
 from misago.users.tokens import make_password_change_token

+ 0 - 1
misago/users/tests/test_lists_views.py

@@ -5,7 +5,6 @@ from django.utils.six.moves import range
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.threads.testutils import post_thread
 from misago.threads.testutils import post_thread
-
 from misago.users.activepostersranking import build_active_posters_ranking
 from misago.users.activepostersranking import build_active_posters_ranking
 from misago.users.models import Rank
 from misago.users.models import Rank
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase

+ 0 - 1
misago/users/tests/test_profile_views.py

@@ -5,7 +5,6 @@ from django.utils.six.moves import range
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.threads import testutils
 from misago.threads import testutils
-
 from misago.users.models import Ban
 from misago.users.models import Ban
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 

+ 0 - 1
misago/users/tests/test_rankadmin_views.py

@@ -2,7 +2,6 @@ from django.urls import reverse
 
 
 from misago.acl.models import Role
 from misago.acl.models import Role
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
-
 from misago.users.models import Rank
 from misago.users.models import Rank
 
 
 
 

+ 0 - 1
misago/users/tests/test_user_avatar_api.py

@@ -9,7 +9,6 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.users.avatars import gallery, store
 from misago.users.avatars import gallery, store
 from misago.users.models import AvatarGallery
 from misago.users.models import AvatarGallery
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase

+ 0 - 1
misago/users/tests/test_user_create_api.py

@@ -3,7 +3,6 @@ from django.core import mail
 from django.urls import reverse
 from django.urls import reverse
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.users.models import Online
 from misago.users.models import Online
 from misago.users.testutils import UserTestCase
 from misago.users.testutils import UserTestCase
 
 

+ 0 - 1
misago/users/tests/test_user_signature_api.py

@@ -5,7 +5,6 @@ from django.utils.encoding import smart_str
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 

+ 0 - 1
misago/users/tests/test_user_username_api.py

@@ -6,7 +6,6 @@ from django.utils.six.moves import range
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 

+ 0 - 1
misago/users/tests/test_useradmin_views.py

@@ -11,7 +11,6 @@ from misago.acl.models import Role
 from misago.admin.testutils import AdminTestCase
 from misago.admin.testutils import AdminTestCase
 from misago.categories.models import Category
 from misago.categories.models import Category
 from misago.threads.testutils import post_thread, reply_thread
 from misago.threads.testutils import post_thread, reply_thread
-
 from misago.users.models import Ban, Rank
 from misago.users.models import Ban, Rank
 
 
 
 

+ 0 - 1
misago/users/tests/test_usernamechanges_api.py

@@ -1,7 +1,6 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 
 
 from misago.acl.testutils import override_acl
 from misago.acl.testutils import override_acl
-
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase
 
 
 
 

+ 0 - 1
misago/users/tests/test_users_api.py

@@ -12,7 +12,6 @@ from misago.core import threadstore
 from misago.core.cache import cache
 from misago.core.cache import cache
 from misago.threads.models import Post, Thread
 from misago.threads.models import Post, Thread
 from misago.threads.testutils import post_thread
 from misago.threads.testutils import post_thread
-
 from misago.users.activepostersranking import build_active_posters_ranking
 from misago.users.activepostersranking import build_active_posters_ranking
 from misago.users.models import Ban, Rank
 from misago.users.models import Ban, Rank
 from misago.users.testutils import AuthenticatedUserTestCase
 from misago.users.testutils import AuthenticatedUserTestCase

+ 3 - 11
misago/users/tests/test_validators.py

@@ -4,19 +4,11 @@ from django.core.exceptions import ValidationError
 from django.test import TestCase
 from django.test import TestCase
 
 
 from misago.conf import settings
 from misago.conf import settings
-
 from misago.users.models import Ban
 from misago.users.models import Ban
 from misago.users.validators import (
 from misago.users.validators import (
-    validate_email,
-    validate_email_available,
-    validate_email_banned,
-    validate_gmail_email,
-    validate_username,
-    validate_username_available,
-    validate_username_banned,
-    validate_username_content,
-    validate_username_length
-)
+    validate_email, validate_email_available, validate_email_banned, validate_gmail_email,
+    validate_username, validate_username_available, validate_username_banned,
+    validate_username_content, validate_username_length)
 
 
 
 
 UserModel = get_user_model()
 UserModel = get_user_model()

+ 0 - 1
misago/users/urls/api.py

@@ -1,7 +1,6 @@
 from django.conf.urls import url
 from django.conf.urls import url
 
 
 from misago.core.apirouter import MisagoApiRouter
 from misago.core.apirouter import MisagoApiRouter
-
 from misago.users.api import auth, captcha
 from misago.users.api import auth, captcha
 from misago.users.api.ranks import RanksViewSet
 from misago.users.api.ranks import RanksViewSet
 from misago.users.api.usernamechanges import UsernameChangesViewSet
 from misago.users.api.usernamechanges import UsernameChangesViewSet

+ 0 - 1
misago/users/views/activation.py

@@ -6,7 +6,6 @@ from django.utils.translation import ugettext as _
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.exceptions import Banned
 from misago.core.exceptions import Banned
 from misago.core.mail import mail_user
 from misago.core.mail import mail_user
-
 from misago.users.bans import get_user_ban
 from misago.users.bans import get_user_ban
 from misago.users.decorators import deny_authenticated, deny_banned_ips
 from misago.users.decorators import deny_authenticated, deny_banned_ips
 from misago.users.tokens import is_activation_token_valid
 from misago.users.tokens import is_activation_token_valid

+ 0 - 1
misago/users/views/admin/bans.py

@@ -2,7 +2,6 @@ from django.contrib import messages
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from misago.admin.views import generic
 from misago.admin.views import generic
-
 from misago.users.forms.admin import BanForm, SearchBansForm
 from misago.users.forms.admin import BanForm, SearchBansForm
 from misago.users.models import Ban
 from misago.users.models import Ban
 
 

+ 0 - 1
misago/users/views/admin/ranks.py

@@ -4,7 +4,6 @@ from django.urls import reverse
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 
 
 from misago.admin.views import generic
 from misago.admin.views import generic
-
 from misago.users.forms.admin import RankForm
 from misago.users.forms.admin import RankForm
 from misago.users.models import Rank
 from misago.users.models import Rank
 
 

+ 1 - 3
misago/users/views/admin/users.py

@@ -12,11 +12,9 @@ from misago.conf import settings
 from misago.core.mail import mail_users
 from misago.core.mail import mail_users
 from misago.core.pgutils import batch_update
 from misago.core.pgutils import batch_update
 from misago.threads.models import Thread
 from misago.threads.models import Thread
-
 from misago.users.avatars.dynamic import set_avatar as set_dynamic_avatar
 from misago.users.avatars.dynamic import set_avatar as set_dynamic_avatar
 from misago.users.forms.admin import (
 from misago.users.forms.admin import (
-    BanUsersForm, NewUserForm, SearchUsersForm,
-    EditUserForm, EditUserFormFactory)
+    BanUsersForm, EditUserForm, EditUserFormFactory, NewUserForm, SearchUsersForm)
 from misago.users.models import Ban, User
 from misago.users.models import Ban, User
 from misago.users.signatures import set_user_signature
 from misago.users.signatures import set_user_signature
 
 

+ 0 - 1
misago/users/views/forgottenpassword.py

@@ -4,7 +4,6 @@ from django.urls import reverse
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
 from misago.core.exceptions import Banned
 from misago.core.exceptions import Banned
-
 from misago.users.bans import get_user_ban
 from misago.users.bans import get_user_ban
 from misago.users.decorators import deny_banned_ips
 from misago.users.decorators import deny_banned_ips
 from misago.users.tokens import is_password_change_token_valid
 from misago.users.tokens import is_password_change_token_valid

+ 1 - 3
misago/users/views/lists.py

@@ -1,14 +1,12 @@
-import six
-
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.shortcuts import render as django_render
 from django.shortcuts import render as django_render
 from django.shortcuts import redirect
 from django.shortcuts import redirect
 from django.urls import reverse
 from django.urls import reverse
 
 
+import six
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict
 from misago.core.utils import format_plaintext_for_html
 from misago.core.utils import format_plaintext_for_html
-
 from misago.users.activepostersranking import get_active_posters_ranking
 from misago.users.activepostersranking import get_active_posters_ranking
 from misago.users.models import Rank
 from misago.users.models import Rank
 from misago.users.pages import users_list
 from misago.users.pages import users_list

+ 0 - 1
misago/users/views/profile.py

@@ -15,7 +15,6 @@ from misago.core.decorators import require_POST
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict, validate_slug
 from misago.core.shortcuts import get_object_or_404, paginate, pagination_dict, validate_slug
 from misago.core.utils import clean_return_path
 from misago.core.utils import clean_return_path
 from misago.threads.permissions import allow_message_user
 from misago.threads.permissions import allow_message_user
-
 from misago.users.bans import get_user_ban
 from misago.users.bans import get_user_ban
 from misago.users.decorators import deny_guests
 from misago.users.decorators import deny_guests
 from misago.users.online.utils import get_user_status
 from misago.users.online.utils import get_user_status