PEP8 cleanups

This commit is contained in:
Roberto Rosario
2014-10-08 18:14:05 -04:00
parent 35f9adbefc
commit 97dcf507ab
30 changed files with 139 additions and 169 deletions

View File

@@ -1,6 +1,5 @@
from __future__ import absolute_import
from django.conf import settings
from django.contrib.comments.models import Comment
from django.contrib.contenttypes import generic
from django.utils.translation import ugettext_lazy as _
@@ -10,14 +9,23 @@ from common.utils import encapsulate
from documents.models import Document
from navigation.api import register_links, register_model_list_columns
from .links import (comment_delete, comment_add,
comments_for_document)
from .links import comment_add, comment_delete, comments_for_document
from .permissions import (PERMISSION_COMMENT_CREATE,
PERMISSION_COMMENT_DELETE, PERMISSION_COMMENT_VIEW)
PERMISSION_COMMENT_DELETE, PERMISSION_COMMENT_VIEW)
if 'django.contrib.comments' not in settings.INSTALLED_APPS:
raise Exception('This app depends on the django.contrib.comments app.')
Document.add_to_class(
'comments',
generic.GenericRelation(
Comment,
content_type_field='content_type',
object_id_field='object_pk'
)
)
class_permissions(Document, [PERMISSION_COMMENT_CREATE,
PERMISSION_COMMENT_DELETE,
PERMISSION_COMMENT_VIEW])
register_model_list_columns(Comment, [
{
@@ -37,18 +45,3 @@ register_model_list_columns(Comment, [
register_links(['comments:comments_for_document', 'comments:comment_add', 'comments:comment_delete', 'comments:comment_multiple_delete'], [comment_add], menu_name='sidebar')
register_links(Comment, [comment_delete])
register_links(Document, [comments_for_document], menu_name='form_header')
Document.add_to_class(
'comments',
generic.GenericRelation(
Comment,
content_type_field='content_type',
object_id_field='object_pk'
)
)
class_permissions(Document, [
PERMISSION_COMMENT_CREATE,
PERMISSION_COMMENT_DELETE,
PERMISSION_COMMENT_VIEW
])