Browse Source

#728: removed * import from misago.core.shortcuts

Rafał Pitoń 8 years ago
parent
commit
0f34216b33

+ 1 - 1
docs/Shortcuts.md

@@ -3,7 +3,7 @@ Shortcut functions
 
 
 Just like [Django](https://docs.djangoproject.com/en/{{ book.django_version }}/topics/http/shortcuts/), Misago defines shortcuts module that reduce some procedures to single functions.
 Just like [Django](https://docs.djangoproject.com/en/{{ book.django_version }}/topics/http/shortcuts/), Misago defines shortcuts module that reduce some procedures to single functions.
 
 
-This module lives in `misago.views.shortcuts` and in addition to Misago-native shortcut functions, it imports whole of `django.shortcuts`, so you don't have to import it separately in your views.
+This module lives in `misago.views.shortcuts`.
 
 
 
 
 ## `paginate(object_list, page, per_page, orphans=0, allow_empty_first_page=True)`
 ## `paginate(object_list, page, per_page, orphans=0, allow_empty_first_page=True)`

+ 0 - 1
misago/core/shortcuts.py

@@ -1,7 +1,6 @@
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
 from django.http import Http404
 from django.http import Http404
-from django.shortcuts import *  # noqa
 
 
 import six
 import six
 
 

+ 2 - 1
misago/threads/api/postendpoints/edits.py

@@ -3,11 +3,12 @@ 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.shortcuts import get_object_or_404
 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 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
 from misago.markup import common_flavour
 from misago.markup import common_flavour
 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

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

@@ -1,5 +1,6 @@
 from django.contrib.auth import get_user_model
 from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied, ValidationError
 from django.core.exceptions import PermissionDenied, ValidationError
+from django.shortcuts import get_object_or_404
 from django.utils import six
 from django.utils import six
 from django.utils.translation import gettext as _
 from django.utils.translation import gettext as _
 
 
@@ -8,7 +9,7 @@ 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.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
 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 (

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

@@ -1,7 +1,9 @@
+from django.shortcuts import get_object_or_404
+
 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 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
 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
 
 

+ 2 - 1
misago/users/api/userendpoints/list.py

@@ -5,11 +5,12 @@ 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.shortcuts import get_object_or_404
 from django.utils import timezone
 from django.utils import timezone
 
 
 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, 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

+ 2 - 1
misago/users/api/usernamechanges.py

@@ -4,9 +4,10 @@ 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.shortcuts import get_object_or_404
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
-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, 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
 
 

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

@@ -9,13 +9,14 @@ from django.core.exceptions import PermissionDenied
 from django.db import transaction
 from django.db import transaction
 from django.db.models import F
 from django.db.models import F
 from django.http import Http404
 from django.http import Http404
+from django.shortcuts import get_object_or_404
 from django.utils.translation import ugettext as _
 from django.utils.translation import ugettext as _
 
 
 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
 from misago.core.rest_permissions import IsAuthenticatedOrReadOnly
 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
 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

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

@@ -1,11 +1,10 @@
 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 redirect
+from django.shortcuts import get_object_or_404, redirect, render as django_render
 from django.urls import reverse
 from django.urls import reverse
+from django.utils import six
 
 
-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 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

+ 2 - 3
misago/users/views/profile.py

@@ -3,8 +3,7 @@ from django.contrib.auth import get_user_model
 from django.core.exceptions import PermissionDenied
 from django.core.exceptions import PermissionDenied
 from django.db.transaction import atomic
 from django.db.transaction import atomic
 from django.http import Http404, JsonResponse
 from django.http import Http404, JsonResponse
-from django.shortcuts import render as django_render
-from django.shortcuts import redirect
+from django.shortcuts import get_object_or_404, redirect, render as django_render
 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 ugettext as _
 from django.utils.translation import ugettext as _
@@ -12,7 +11,7 @@ from django.utils.translation import ugettext as _
 from misago.acl import add_acl
 from misago.acl import add_acl
 from misago.conf import settings
 from misago.conf import settings
 from misago.core.decorators import require_POST
 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 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