imports cleanup

This commit is contained in:
nitely 2015-07-11 00:03:08 -03:00
parent 1a6c07c560
commit be66ff3648
102 changed files with 239 additions and 275 deletions

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -2,10 +2,11 @@
from __future__ import unicode_literals
from djconfig.forms import ConfigForm
from django import forms
from django.utils.translation import ugettext_lazy as _
from djconfig.forms import ConfigForm
class BasicConfigForm(ConfigForm):

View File

@ -7,21 +7,22 @@ from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.contrib.auth import get_user_model
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.admin.views import dashboard
from spirit.admin import views
from spirit.category.admin import views as category_views
from spirit.comment.flag.admin import views as flag_views
from spirit.topic.admin import views as topic_views
from spirit.user.admin import views as user_views
from spirit.category.models import Category
from spirit.comment.flag.models import CommentFlag, Flag
from spirit.admin.forms import BasicConfigForm
from spirit.comment.flag.admin.forms import CommentFlagForm
from spirit.user.admin.forms import UserForm, UserProfileForm
from spirit.category.admin.forms import CategoryForm
from ..core.tests import utils
from ..admin.views import dashboard
from ..admin import views
from ..category.admin import views as category_views
from ..comment.flag.admin import views as flag_views
from ..topic.admin import views as topic_views
from ..user.admin import views as user_views
from ..category.models import Category
from ..comment.flag.models import CommentFlag, Flag
from ..admin.forms import BasicConfigForm
from ..comment.flag.admin.forms import CommentFlagForm
from ..user.admin.forms import UserForm, UserProfileForm
from ..category.admin.forms import CategoryForm
User = get_user_model()

View File

@ -13,7 +13,7 @@ from ..comment.flag.models import CommentFlag
from ..comment.like.models import CommentLike
from ..comment.models import Comment
from ..topic.models import Topic
from spirit.core.utils.decorators import administrator_required
from ..core.utils.decorators import administrator_required
from .forms import BasicConfigForm
User = get_user_model()

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -8,7 +8,7 @@ from django.core.urlresolvers import reverse
from django.contrib import messages
from django.utils.translation import ugettext as _
from spirit.core.utils.decorators import administrator_required
from ...core.utils.decorators import administrator_required
from ..models import Category
from .forms import CategoryForm

View File

@ -9,7 +9,7 @@ from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from .managers import CategoryQuerySet
from spirit.core.utils.models import AutoSlugField
from ..core.utils.models import AutoSlugField
@python_2_unicode_compatible

View File

@ -8,11 +8,12 @@ from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.utils import timezone
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.topic.models import Topic
from spirit.comment.bookmark.models import CommentBookmark
from ..core.tests import utils
from ..topic.models import Topic
from ..comment.bookmark.models import CommentBookmark
class CategoryViewTest(TestCase):

View File

@ -3,15 +3,12 @@
from __future__ import unicode_literals
from django.views.generic import ListView
from django.shortcuts import render
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from djconfig import config
from spirit.core.utils.paginator import yt_paginate
from ..core.utils.paginator import yt_paginate
from ..topic.models import Topic
from .models import Category

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -6,8 +6,10 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from djconfig import config
import spirit.core.utils.paginator
from ...core.utils import paginator
@python_2_unicode_compatible
@ -29,7 +31,7 @@ class CommentBookmark(models.Model):
% (self.user.username, self.topic.title, self.comment_number)
def get_absolute_url(self):
return spirit.core.utils.paginator.get_url(self.topic.get_absolute_url(),
return paginator.get_url(self.topic.get_absolute_url(),
self.comment_number,
config.comments_per_page,
'page')

View File

@ -6,12 +6,13 @@ from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from django.template import Template, Context
from django.core.cache import cache
from djconfig import config
from spirit.core.tests import utils
from spirit.comment.bookmark.models import CommentBookmark
from spirit.topic.signals import topic_viewed
from spirit.comment.bookmark.forms import BookmarkForm
from ...core.tests import utils
from ...topic.signals import topic_viewed
from .models import CommentBookmark
from .forms import BookmarkForm
class CommentBookmarkViewTest(TestCase):

View File

@ -8,7 +8,7 @@ from django.shortcuts import redirect
from django.views.decorators.http import require_POST
from django.http import Http404
from spirit.core.utils import json_response
from ...core.utils import json_response
from ...topic.models import Topic
from .forms import BookmarkForm

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -5,7 +5,6 @@ from __future__ import unicode_literals
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.utils.translation import ugettext as _
from djconfig import config

View File

@ -6,9 +6,9 @@ from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.cache import cache
from spirit.core.tests import utils
from spirit.comment.flag.models import Flag, CommentFlag
from spirit.comment.flag.forms import FlagForm
from ...core.tests import utils
from .models import Flag, CommentFlag
from .forms import FlagForm
class FlagViewTest(TestCase):

View File

@ -10,8 +10,8 @@ from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import spirit.core.utils
from spirit.core.utils.markdown import Markdown
from ..core import utils
from ..core.utils.markdown import Markdown
from .models import Comment
from ..topic.models import Topic
@ -92,7 +92,7 @@ class CommentImageForm(forms.Form):
upload_to = os.path.join('spirit', 'images', str(self.user.pk))
image.url = os.path.join(settings.MEDIA_URL, upload_to, image.name).replace("\\", "/")
media_path = os.path.join(settings.MEDIA_ROOT, upload_to)
spirit.core.utils.mkdir_p(media_path)
utils.mkdir_p(media_path)
with open(os.path.join(media_path, image.name), 'wb') as fh:
image.seek(0)

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -5,11 +5,12 @@ from __future__ import unicode_literals
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.cache import cache
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.comment.history.models import CommentHistory
from spirit.comment.signals import comment_pre_update, comment_post_update
from ...core.tests import utils
from .models import CommentHistory
from .signals import comment_pre_update, comment_post_update
class CommentHistoryViewTest(TestCase):

View File

@ -3,12 +3,11 @@
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404
from djconfig import config
from spirit.core.utils.paginator import yt_paginate
from ...core.utils.paginator import yt_paginate
from .models import CommentHistory
from ..models import Comment

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from spirit.core.tags.registry import register
from ...core.tags.registry import register
from .forms import LikeForm

View File

@ -7,10 +7,10 @@ from django.core.urlresolvers import reverse
from django.template import Template, Context
from django.core.cache import cache
from spirit.core.tests import utils
from spirit.comment.like.models import CommentLike
from spirit.comment.like.forms import LikeForm
from spirit.comment.like.tags import render_like_form
from ...core.tests import utils
from .models import CommentLike
from .forms import LikeForm
from .tags import render_like_form
class LikeViewTest(TestCase):

View File

@ -6,7 +6,7 @@ from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from spirit.core.utils import json_response
from ...core.utils import json_response
from ..models import Comment
from .models import CommentLike
from .forms import LikeForm

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from spirit.core.tags.registry import register
from ..core.tags.registry import register
from .forms import CommentForm
from .models import MOVED, CLOSED, UNCLOSED, PINNED, UNPINNED

View File

@ -16,18 +16,18 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.utils import override_settings
from django.utils.six import BytesIO
from spirit.core.tests import utils
from spirit.comment.models import Comment
from spirit.comment.like.signals import comment_like_post_create, comment_like_post_delete
from spirit.topic.moderate.signals import topic_post_moderate
from spirit.comment.forms import CommentForm, CommentMoveForm, CommentImageForm
from spirit.comment.signals import comment_post_update, comment_posted, comment_pre_update, comment_moved
from spirit.comment.tags import render_comments_form
from spirit.core.utils import markdown
from spirit.comment.views import delete as comment_delete
from spirit.topic.models import Topic
from spirit.category.models import Category
from spirit.user.models import UserProfile
from ..core.tests import utils
from .models import Comment
from .like.signals import comment_like_post_create, comment_like_post_delete
from ..topic.moderate.signals import topic_post_moderate
from .forms import CommentForm, CommentMoveForm, CommentImageForm
from .signals import comment_post_update, comment_posted, comment_pre_update, comment_moved
from .tags import render_comments_form
from ..core.utils import markdown
from .views import delete as comment_delete
from ..topic.models import Topic
from ..category.models import Category
from ..user.models import UserProfile
User = get_user_model()

View File

@ -6,17 +6,13 @@ from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_POST
from django.contrib import messages
from django.http import Http404
from djconfig import config
import spirit.core.utils.paginator
from spirit.core.utils.ratelimit.decorators import ratelimit
from spirit.core.utils.decorators import moderator_required
from spirit.core.utils import markdown
from spirit.core.utils import render_form_errors
from spirit.core.utils import json_response
from ..core.utils.ratelimit.decorators import ratelimit
from ..core.utils.decorators import moderator_required
from ..core.utils import markdown, paginator, render_form_errors, json_response
from ..topic.models import Topic
from .models import Comment
from .forms import CommentForm, CommentMoveForm, CommentImageForm
@ -112,7 +108,7 @@ def move(request, topic_id):
def find(request, pk):
comment = get_object_or_404(Comment, pk=pk)
comment_number = Comment.objects.filter(topic=comment.topic, date__lte=comment.date).count()
url = spirit.core.utils.paginator.get_url(comment.topic.get_absolute_url(),
url = paginator.get_url(comment.topic.get_absolute_url(),
comment_number,
config.comments_per_page,
'page')

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -5,7 +5,7 @@ import math
from django.utils.encoding import smart_text
from spirit.core.tags.registry import register
from .registry import register
@register.simple_tag()

View File

@ -5,7 +5,7 @@ import hashlib
from django.utils.http import urlencode, urlquote
from spirit.core.tags.registry import register
from .registry import register
@register.simple_tag()

View File

@ -5,7 +5,7 @@ from collections import OrderedDict
from django.contrib.messages import constants
from spirit.core.tags.registry import register
from .registry import register
TAGS = {

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
from django.template.loader import render_to_string
from django.core.paginator import Page
from spirit.core.tags.registry import register
from .registry import register
@register.simple_tag(takes_context=True)

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.utils.http import urlencode
from spirit.core.tags.registry import register
from .registry import register
FACEBOOK_URL = "http://www.facebook.com/sharer.php?%s"

View File

@ -7,7 +7,7 @@ from django.template import defaultfilters
from django.utils.translation import ugettext as _
from django.utils.timezone import is_aware, utc
from spirit.core.tags.registry import register
from .registry import register
@register.filter(expects_localtime=True)

View File

@ -2,13 +2,13 @@
from __future__ import unicode_literals
from spirit.comment import tags as comment
from spirit.comment.like import tags as comment_like
from spirit.search import tags as search
from spirit.topic.favorite import tags as topic_favorite
from spirit.topic.notification import tags as topic_notification
from spirit.topic.poll import tags as topic_poll
from spirit.topic.private import tags as topic_private
from ...comment import tags as comment
from ...comment.like import tags as comment_like
from ...search import tags as search
from ...topic.favorite import tags as topic_favorite
from ...topic.notification import tags as topic_notification
from ...topic.poll import tags as topic_poll
from ...topic.private import tags as topic_private
from ..tags import avatar
from ..tags import gravatar
from ..tags import messages

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -2,7 +2,7 @@
from django.db import models
from spirit.core.utils.models import AutoSlugField
from ...utils.models import AutoSlugField
class AutoSlugModel(models.Model):

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
from django.test import TestCase
from django.template import Template, Context
from spirit.core.tests import utils
from . import utils
class GravatarTemplateTagTests(TestCase):

View File

@ -24,19 +24,18 @@ from django.utils.timezone import utc
from django.utils.http import urlunquote
from django.contrib.auth import get_user_model
from spirit.category.models import Category
import spirit.core.utils
from spirit.core.utils.forms import NestedModelChoiceField
from spirit.core.utils.timezone import TIMEZONE_CHOICES
from spirit.core.utils.decorators import moderator_required, administrator_required
import spirit.core.utils
from spirit.user.utils.tokens import UserActivationTokenGenerator, UserEmailChangeTokenGenerator
from spirit.user.utils.email import send_activation_email, send_email_change_email, sender
from spirit.user.utils import email
from spirit.core.tags import time as ttags_utils
from spirit.core.tests import utils as test_utils
from spirit.core.tags.messages import render_messages
from spirit.core.utils.markdown import Markdown, quotify
from ...category.models import Category
from .. import utils
from ..utils.forms import NestedModelChoiceField
from ..utils.timezone import TIMEZONE_CHOICES
from ..utils.decorators import moderator_required, administrator_required
from ...user.utils.tokens import UserActivationTokenGenerator, UserEmailChangeTokenGenerator
from ...user.utils.email import send_activation_email, send_email_change_email, sender
from ...user.utils import email
from ..tags import time as ttags_utils
from ..tests import utils as test_utils
from ..tags.messages import render_messages
from ..utils.markdown import Markdown, quotify
User = get_user_model()
@ -55,7 +54,7 @@ class UtilsTests(TestCase):
hidden_fields = [{'errors': "error2", }, ]
visible_fields = [{'errors': "error3", }, ]
res = spirit.core.utils.render_form_errors(MockForm())
res = utils.render_form_errors(MockForm())
lines = [line.strip() for line in res.splitlines()]
self.assertEqual("".join(lines), '<ul class="errorlist"><li>error1</li><li>error2</li><li>error3</li></ul>')
@ -63,16 +62,16 @@ class UtilsTests(TestCase):
"""
return json_response
"""
res = spirit.core.utils.json_response()
res = utils.json_response()
self.assertIsInstance(res, HttpResponse)
self.assertEqual(res.status_code, 200)
self.assertEqual(res['Content-Type'], 'application/json')
self.assertDictEqual(json.loads(res.content.decode('utf-8')), {})
res = spirit.core.utils.json_response({"foo": "bar", })
res = utils.json_response({"foo": "bar", })
self.assertDictEqual(json.loads(res.content.decode('utf-8')), {"foo": "bar", })
res = spirit.core.utils.json_response(status=404)
res = utils.json_response(status=404)
self.assertEqual(res.status_code, 404)
def test_mkdir_p(self):
@ -80,11 +79,11 @@ class UtilsTests(TestCase):
mkdir -p
"""
# Empty path should raise an exception
self.assertRaises(OSError, spirit.core.utils.mkdir_p, "")
self.assertRaises(OSError, utils.mkdir_p, "")
# Try to create an existing dir should do nothing
self.assertTrue(os.path.isdir(settings.BASE_DIR))
spirit.core.utils.mkdir_p(settings.BASE_DIR)
utils.mkdir_p(settings.BASE_DIR)
# Create path tree
# setup
@ -93,7 +92,7 @@ class UtilsTests(TestCase):
self.assertFalse(os.path.isdir(sub_path))
self.assertFalse(os.path.isdir(path))
# test
spirit.core.utils.mkdir_p(sub_path)
utils.mkdir_p(sub_path)
self.assertTrue(os.path.isdir(sub_path))
# clean up
os.rmdir(sub_path)

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.test import TestCase
from spirit.core.tests.models import AutoSlugPopulateFromModel, AutoSlugModel, AutoSlugDefaultModel, \
from .models import AutoSlugPopulateFromModel, AutoSlugModel, AutoSlugDefaultModel, \
AutoSlugBadPopulateFromModel

View File

@ -9,13 +9,13 @@ from django.test.utils import override_settings
from django.http import Http404
from django.core.paginator import Page, Paginator
from spirit.core.tests import utils
from spirit.comment.models import Comment
import spirit.core.utils.paginator
from spirit.core.utils.paginator import YTPaginator, InvalidPage, YTPage
from spirit.core.utils.paginator import infinite_paginator, paginate, yt_paginate
from spirit.core.tags.paginator import render_paginator
from spirit.core.tags import paginator as ttag_paginator
from ..tests import utils
from ...comment.models import Comment
from ..utils import paginator
from ..utils.paginator import YTPaginator, InvalidPage, YTPage
from ..utils.paginator import infinite_paginator, paginate, yt_paginate
from ..tags.paginator import render_paginator
from ..tags import paginator as ttag_paginator
class UtilsPaginatorTest(TestCase):
@ -26,13 +26,13 @@ class UtilsPaginatorTest(TestCase):
def test_paginator_page(self):
per_page = 15
obj_number = 1
self.assertEqual(spirit.core.utils.paginator.get_page_number(obj_number=obj_number, per_page=per_page), 1)
self.assertEqual(paginator.get_page_number(obj_number=obj_number, per_page=per_page), 1)
obj_number = per_page
self.assertEqual(spirit.core.utils.paginator.get_page_number(obj_number=obj_number, per_page=per_page), 1)
self.assertEqual(paginator.get_page_number(obj_number=obj_number, per_page=per_page), 1)
obj_number = per_page - 1
self.assertEqual(spirit.core.utils.paginator.get_page_number(obj_number=obj_number, per_page=per_page), 1)
self.assertEqual(paginator.get_page_number(obj_number=obj_number, per_page=per_page), 1)
obj_number = per_page + 1
self.assertEqual(spirit.core.utils.paginator.get_page_number(obj_number=obj_number, per_page=per_page), 2)
self.assertEqual(paginator.get_page_number(obj_number=obj_number, per_page=per_page), 2)
def test_paginator_url(self):
per_page = 15
@ -40,13 +40,13 @@ class UtilsPaginatorTest(TestCase):
page_var = "page"
url = "/path/"
first_page = url + '#c' + str(obj_number)
self.assertEqual(spirit.core.utils.paginator.get_url(url, obj_number, per_page, page_var), first_page)
self.assertEqual(paginator.get_url(url, obj_number, per_page, page_var), first_page)
obj_number = 16
expected = '%(url)s?%(page_var)s=%(page_num)s#c%(obj_number)s' % {'url': url,
'page_var': page_var,
'page_num': 2,
'obj_number': obj_number}
self.assertEqual(spirit.core.utils.paginator.get_url(url, obj_number, per_page, page_var), expected)
self.assertEqual(paginator.get_url(url, obj_number, per_page, page_var), expected)
class UtilsInfinitePaginatorTest(TestCase):

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
from django.core.cache import cache
@ -11,8 +10,8 @@ from django.contrib.messages.storage.fallback import FallbackStorage
from django.conf import settings
from django.core.cache import get_cache
from spirit.core.utils.ratelimit import RateLimit
from spirit.core.utils.ratelimit.decorators import ratelimit
from ..utils.ratelimit import RateLimit
from ..utils.ratelimit.decorators import ratelimit
def setup_request_factory_messages(req):

View File

@ -5,11 +5,10 @@ from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.conf import settings
from spirit.topic.models import Topic
from spirit.category.models import Category
from spirit.comment.models import Comment
from spirit.topic.private.models import TopicPrivate
from ...topic.models import Topic
from ...category.models import Category
from ...comment.models import Comment
from ...topic.private.models import TopicPrivate
User = get_user_model()

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import copy
import os
@ -9,9 +8,10 @@ import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.staticfiles.storage import staticfiles_storage
import mistune
from spirit.core.utils.markdown.utils.emoji import emojis
from .utils.emoji import emojis
User = get_user_model()

View File

@ -4,9 +4,9 @@ from __future__ import unicode_literals
import mistune
from spirit.core.utils.markdown.block import BlockLexer
from spirit.core.utils.markdown.inline import InlineLexer
from spirit.core.utils.markdown.renderer import Renderer
from .block import BlockLexer
from .inline import InlineLexer
from .renderer import Renderer
class Markdown(mistune.Markdown):

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models.fields import SlugField
from django.utils.text import slugify
from django.utils.encoding import smart_text

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from spirit.core.utils.ratelimit.ratelimit import RateLimit
from .ratelimit import RateLimit
__all__ = ['RateLimit']

View File

@ -7,7 +7,7 @@ import functools
from django.contrib import messages
from django.utils.translation import ugettext as _
from spirit.core.utils.ratelimit.ratelimit import RateLimit
from .ratelimit import RateLimit
__all__ = ['ratelimit', ]

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from haystack.forms import SearchForm
from haystack.query import EmptySearchQuerySet

View File

@ -6,7 +6,7 @@ from django.conf import settings
from haystack import indexes
from spirit.topic.models import Topic
from ..topic.models import Topic
class TopicIndex(indexes.SearchIndex, indexes.Indexable):

View File

@ -2,8 +2,8 @@
from __future__ import unicode_literals
from spirit.core.tags.registry import register
from spirit.search.forms import BasicSearchForm
from ..core.tags.registry import register
from .forms import BasicSearchForm
@register.inclusion_tag('spirit/search/_form.html')
@ -14,7 +14,7 @@ def render_search_form():
@register.assignment_tag()
def get_topics_from_search_result(results):
# TODO: move to view
# TODO: move to view, use iter
# Since Im only indexing Topics this is ok.
topics = [r.object for r in results]
return topics

View File

@ -8,14 +8,15 @@ from django.core.urlresolvers import reverse
from django.template import Template, Context
from django.conf import settings
from django.core.management import call_command
from haystack.query import SearchQuerySet
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.topic.models import Topic
from spirit.search.forms import BasicSearchForm, AdvancedSearchForm
from spirit.search.tags import render_search_form
from spirit.search.search_indexes import TopicIndex
from ..core.tests import utils
from ..topic.models import Topic
from .forms import BasicSearchForm, AdvancedSearchForm
from .tags import render_search_form
from .search_indexes import TopicIndex
HAYSTACK_TEST = {
'default': {

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
from haystack.views import SearchView as BaseSearchView
from djconfig import config
from spirit.core.utils.paginator import yt_paginate
from ..core.utils.paginator import yt_paginate
class SearchView(BaseSearchView):

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -3,10 +3,11 @@
from __future__ import unicode_literals
from django.shortcuts import render
from djconfig import config
from spirit.core.utils.paginator import yt_paginate
from spirit.core.utils.decorators import administrator_required
from ...core.utils.paginator import yt_paginate
from ...core.utils.decorators import administrator_required
from ..models import Topic

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from spirit.core.tags.registry import register
from ...core.tags.registry import register
from .models import TopicFavorite
from .forms import FavoriteForm

View File

@ -6,9 +6,9 @@ from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.cache import cache
from spirit.core.tests import utils
from spirit.topic.favorite.models import TopicFavorite
from spirit.topic.favorite.forms import FavoriteForm
from ...core.tests import utils
from .models import TopicFavorite
from .forms import FavoriteForm
class FavoriteViewTest(TestCase):

View File

@ -11,7 +11,7 @@ from django.contrib import messages
from .models import TopicFavorite
from .forms import FavoriteForm
from ..models import Topic
import spirit.core.utils
from ...core import utils
@require_POST
@ -23,7 +23,7 @@ def create(request, topic_id):
if form.is_valid():
form.save()
else:
messages.error(request, spirit.core.utils.render_form_errors(form))
messages.error(request, utils.render_form_errors(form))
return redirect(request.POST.get('next', topic.get_absolute_url()))

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from spirit.core.utils.forms import NestedModelChoiceField
from ..core.utils.forms import NestedModelChoiceField
from ..category.models import Category
from .models import Topic

View File

@ -6,7 +6,7 @@ from django.db import models
from django.shortcuts import get_object_or_404
from django.db.models import Q, Prefetch
from spirit.comment.bookmark.models import CommentBookmark
from ..comment.bookmark.models import CommentBookmark
class TopicQuerySet(models.QuerySet):

View File

@ -9,7 +9,7 @@ from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from .managers import TopicQuerySet
from spirit.core.utils.models import AutoSlugField
from ..core.utils.models import AutoSlugField
@python_2_unicode_compatible

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -6,10 +6,10 @@ from django.test import TestCase
from django.core.cache import cache
from django.core.urlresolvers import reverse
from spirit.core.tests import utils
from spirit.comment.models import CLOSED, UNCLOSED, PINNED, UNPINNED
from spirit.topic.models import Topic
from spirit.topic.moderate.signals import topic_post_moderate
from ...core.tests import utils
from ...comment.models import CLOSED, UNCLOSED, PINNED, UNPINNED
from ..models import Topic
from .signals import topic_post_moderate
class TopicViewTest(TestCase):

View File

@ -6,7 +6,7 @@ from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import View
from django.utils.decorators import method_decorator
from spirit.core.utils.decorators import moderator_required
from ...core.utils.decorators import moderator_required
from ...comment.models import CLOSED, UNCLOSED, PINNED, UNPINNED
from ..models import Topic
from .signals import topic_post_moderate

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -2,8 +2,7 @@
from __future__ import unicode_literals
from spirit.core.tags.registry import register
from ...core.tags.registry import register
from .models import TopicNotification
from .forms import NotificationForm

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import datetime
@ -11,16 +10,17 @@ from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.template import Template, Context
from django.utils import timezone
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.topic.private.models import TopicPrivate
from spirit.topic.notification.models import TopicNotification, COMMENT, MENTION
from spirit.comment.signals import comment_posted
from spirit.topic.signals import topic_viewed
from spirit.topic.private.signals import topic_private_post_create, topic_private_access_pre_create
from spirit.topic.notification.forms import NotificationCreationForm, NotificationForm
from spirit.topic.notification.tags import render_notification_form, has_topic_notifications
from ...core.tests import utils
from ..private.models import TopicPrivate
from .models import TopicNotification, COMMENT, MENTION
from ...comment.signals import comment_posted
from ..signals import topic_viewed
from ..private.signals import topic_private_post_create, topic_private_access_pre_create
from .forms import NotificationCreationForm, NotificationForm
from .tags import render_notification_form, has_topic_notifications
@override_settings(ST_NOTIFICATIONS_PER_PAGE=1)

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from django.contrib.auth.decorators import login_required
@ -14,15 +13,14 @@ from django.utils.html import escape
from djconfig import config
import spirit.core.utils
from spirit.core.utils.paginator import yt_paginate
from spirit.core.utils.paginator.infinite_paginator import paginate
from ...core import utils
from ...core.utils.paginator import yt_paginate
from ...core.utils.paginator.infinite_paginator import paginate
from ...topic.models import Topic
from .models import TopicNotification
from .forms import NotificationForm, NotificationCreationForm
@require_POST
@login_required
def create(request, topic_id):
@ -33,7 +31,7 @@ def create(request, topic_id):
if form.is_valid():
form.save()
else:
messages.error(request, spirit.core.utils.render_form_errors(form))
messages.error(request, utils.render_form_errors(form))
return redirect(request.POST.get('next', topic.get_absolute_url()))
@ -47,7 +45,7 @@ def update(request, pk):
if form.is_valid():
form.save()
else:
messages.error(request, spirit.core.utils.render_form_errors(form))
messages.error(request, utils.render_form_errors(form))
return redirect(request.POST.get('next', notification.topic.get_absolute_url()))

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import models
from spirit.core.tags.registry import register
from ...core.tags.registry import register
from .forms import TopicPollVoteManyForm

View File

@ -8,11 +8,11 @@ from django.core.cache import cache
from django.contrib.auth import get_user_model
from django.template import Template, Context
from spirit.core.tests import utils
from spirit.topic.poll.models import TopicPoll, TopicPollChoice, TopicPollVote
from spirit.topic.poll.forms import TopicPollForm, TopicPollChoiceFormSet, TopicPollVoteManyForm
from spirit.topic.poll.signals import topic_poll_post_vote, topic_poll_pre_vote
from spirit.topic.poll.tags import render_poll_form
from ...core.tests import utils
from .models import TopicPoll, TopicPollChoice, TopicPollVote
from .forms import TopicPollForm, TopicPollChoiceFormSet, TopicPollVoteManyForm
from .signals import topic_poll_post_vote, topic_poll_pre_vote
from .tags import render_poll_form
User = get_user_model()

View File

@ -12,7 +12,7 @@ from django.conf import settings
from .models import TopicPoll
from .forms import TopicPollChoiceFormSet, TopicPollForm, TopicPollVoteManyForm
from .signals import topic_poll_pre_vote, topic_poll_post_vote
import spirit.core.utils
from ...core import utils
@login_required
@ -72,5 +72,5 @@ def vote(request, pk):
topic_poll_post_vote.send(sender=poll.__class__, poll=poll, user=request.user)
return redirect(request.POST.get('next', poll.get_absolute_url()))
messages.error(request, spirit.core.utils.render_form_errors(form))
messages.error(request, utils.render_form_errors(form))
return redirect(request.POST.get('next', poll.get_absolute_url()))

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
from django.conf import settings
from spirit.core.utils.widgets import MultipleInput
from ...core.utils.widgets import MultipleInput
from ...topic.models import Topic
from ...category.models import Category
from .models import TopicPrivate

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from spirit.core.tags.registry import register
from ...core.tags.registry import register
from .forms import TopicPrivateInviteForm

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.test import TestCase
@ -11,19 +10,20 @@ from django.template import Template, Context
from django.conf import settings
from django.utils import six
from django.utils import timezone
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.category.models import Category
from spirit.topic.private.models import TopicPrivate
from spirit.topic.private.forms import TopicForPrivateForm, TopicPrivateInviteForm,\
from ...core.tests import utils
from ...category.models import Category
from .models import TopicPrivate
from .forms import TopicForPrivateForm, TopicPrivateInviteForm,\
TopicPrivateManyForm, TopicPrivateJoinForm
from spirit.topic.private.tags import render_invite_form
from spirit.topic.private.views import comment_posted
from spirit.comment.models import Comment
from spirit.topic.private.signals import topic_private_post_create, topic_private_access_pre_create
from spirit.topic.models import Topic
from spirit.comment.bookmark.models import CommentBookmark
from .tags import render_invite_form
from .views import comment_posted
from ...comment.models import Comment
from .signals import topic_private_post_create, topic_private_access_pre_create
from ..models import Topic
from ...comment.bookmark.models import CommentBookmark
class TopicPrivateViewTest(TestCase):

View File

@ -10,11 +10,12 @@ from django.views.decorators.http import require_POST
from django.contrib import messages
from django.http import HttpResponsePermanentRedirect
from django.conf import settings
from djconfig import config
import spirit.core.utils
from spirit.core.utils.paginator import paginate, yt_paginate
from spirit.core.utils.ratelimit.decorators import ratelimit
from ...core import utils
from ...core.utils.paginator import paginate, yt_paginate
from ...core.utils.ratelimit.decorators import ratelimit
from ...comment.forms import CommentForm
from ...comment.signals import comment_posted
from ...comment.models import Comment
@ -110,7 +111,7 @@ def create_access(request, topic_id):
user=form.cleaned_data['user'])
form.save()
else:
messages.error(request, spirit.core.utils.render_form_errors(form))
messages.error(request, utils.render_form_errors(form))
return redirect(request.POST.get('next', topic_private.get_absolute_url()))

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.test import TestCase, RequestFactory
@ -9,18 +8,19 @@ from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.comment.models import MOVED
from spirit.topic.models import Topic
from spirit.comment.signals import comment_posted, comment_moved
from spirit.topic.signals import topic_viewed
from spirit.topic.forms import TopicForm
from spirit.topic.moderate.signals import topic_post_moderate
from spirit.comment.models import Comment
from spirit.comment.bookmark.models import CommentBookmark
from spirit.topic.poll.forms import TopicPollForm, TopicPollChoiceFormSet
from ..core.tests import utils
from ..comment.models import MOVED
from .models import Topic
from ..comment.signals import comment_posted, comment_moved
from .signals import topic_viewed
from .forms import TopicForm
from .moderate.signals import topic_post_moderate
from ..comment.models import Comment
from ..comment.bookmark.models import CommentBookmark
from .poll.forms import TopicPollForm, TopicPollChoiceFormSet
class TopicViewTest(TestCase):

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -6,11 +6,11 @@ from django.core.cache import cache
from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from spirit.core.tests import utils
from spirit.topic.unread.models import TopicUnread
from spirit.topic.signals import topic_viewed
from spirit.comment.signals import comment_posted
from spirit.comment.bookmark.models import CommentBookmark
from ...core.tests import utils
from .models import TopicUnread
from ..signals import topic_viewed
from ...comment.signals import comment_posted
from ...comment.bookmark.models import CommentBookmark
class TopicUnreadViewTest(TestCase):

View File

@ -6,7 +6,7 @@ from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from spirit.core.utils.paginator.infinite_paginator import paginate
from ...core.utils.paginator.infinite_paginator import paginate
from ..models import Topic

View File

@ -4,13 +4,12 @@ from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponsePermanentRedirect
from djconfig import config
from spirit.core.utils.paginator import paginate, yt_paginate
from spirit.core.utils.ratelimit.decorators import ratelimit
from ..core.utils.paginator import paginate, yt_paginate
from ..core.utils.ratelimit.decorators import ratelimit
from ..category.models import Category
from ..comment.models import MOVED
from ..comment.forms import CommentForm

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -5,13 +5,12 @@ from __future__ import unicode_literals
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from djconfig import config
from spirit.core.utils.paginator import yt_paginate
from spirit.core.utils.decorators import administrator_required
from ...core.utils.paginator import yt_paginate
from ...core.utils.decorators import administrator_required
from .forms import UserForm, UserProfileForm
User = get_user_model()

View File

@ -1 +0,0 @@
__author__ = 'esteban'

View File

@ -5,7 +5,6 @@ from __future__ import unicode_literals
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
User = get_user_model()

View File

@ -9,7 +9,6 @@ from django.utils.translation import ugettext_lazy as _
from ..forms import EmailUniqueMixin
User = get_user_model()

View File

@ -9,7 +9,7 @@ from django.shortcuts import redirect, render, get_object_or_404
from django.utils.translation import ugettext as _
from django.contrib.auth import get_user_model
from spirit.core.utils.ratelimit.decorators import ratelimit
from ...core.utils.ratelimit.decorators import ratelimit
from ..utils.email import send_activation_email
from ..utils.tokens import UserActivationTokenGenerator
from .forms import RegistrationForm, LoginForm, ResendActivationForm

View File

@ -11,7 +11,6 @@ from django.conf import settings
from .models import UserProfile
User = get_user_model()

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.db import models
@ -13,8 +12,8 @@ from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.conf import settings
from spirit.core.utils.timezone import TIMEZONE_CHOICES
from spirit.core.utils.models import AutoSlugField
from ..core.utils.timezone import TIMEZONE_CHOICES
from ..core.utils.models import AutoSlugField
class UserProfile(models.Model):

View File

@ -5,8 +5,7 @@ from __future__ import unicode_literals
from django.db.models.signals import post_save
from django.contrib.auth import get_user_model
from spirit.user.models import UserProfile
from .models import UserProfile
User = get_user_model()

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.test import TestCase
@ -13,19 +12,19 @@ from django.utils.translation import ugettext as _
from django.utils import timezone
from django.test.utils import override_settings
from django.core.urlresolvers import NoReverseMatch
from djconfig.utils import override_djconfig
from spirit.core.tests import utils
from spirit.user.forms import UserProfileForm, EmailChangeForm, UserForm, EmailCheckForm
from spirit.user.auth.forms import RegistrationForm, ResendActivationForm
from spirit.user.auth.backends import EmailAuthBackend
from spirit.comment.like.models import CommentLike
from spirit.user.utils.tokens import UserActivationTokenGenerator, UserEmailChangeTokenGenerator
from spirit.user.models import UserProfile
from spirit.topic.models import Topic
from spirit.comment.models import Comment
from spirit.comment.bookmark.models import CommentBookmark
from ..core.tests import utils
from .forms import UserProfileForm, EmailChangeForm, UserForm, EmailCheckForm
from .auth.forms import RegistrationForm, ResendActivationForm
from .auth.backends import EmailAuthBackend
from ..comment.like.models import CommentLike
from .utils.tokens import UserActivationTokenGenerator, UserEmailChangeTokenGenerator
from .models import UserProfile
from ..topic.models import Topic
from ..comment.models import Comment
from ..comment.bookmark.models import CommentBookmark
User = get_user_model()

Some files were not shown because too many files have changed in this diff Show More