PEP8 cleanups
This commit is contained in:
@@ -23,7 +23,7 @@ from .links import (
|
||||
from .menus import (
|
||||
menu_facet, menu_main, menu_secondary, menu_setup, menu_tools
|
||||
)
|
||||
from .models import AnonymousUserSingleton, UserLocaleProfile
|
||||
from .models import AnonymousUserSingleton
|
||||
from .settings import TEMPORARY_DIRECTORY
|
||||
from .utils import validate_path
|
||||
|
||||
|
||||
@@ -83,4 +83,3 @@ class MissingItem(object):
|
||||
self.description = description
|
||||
self.view = view
|
||||
self.__class__._registry.append(self)
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import os
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from django.utils.html import escape
|
||||
@@ -13,7 +12,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .models import UserLocaleProfile
|
||||
from .utils import return_attrib
|
||||
from .widgets import DetailSelectMultiple, EmailInput, PlainWidget
|
||||
from .widgets import DetailSelectMultiple, PlainWidget
|
||||
|
||||
|
||||
class DetailForm(forms.ModelForm):
|
||||
|
||||
@@ -2,9 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from .models import (
|
||||
AnonymousUserSingleton, UserLocaleProfile
|
||||
)
|
||||
from .models import UserLocaleProfile
|
||||
|
||||
|
||||
def user_locale_profile_session_config(sender, request, user, **kwargs):
|
||||
|
||||
@@ -14,4 +14,3 @@ def project_name():
|
||||
@register.simple_tag
|
||||
def project_version():
|
||||
return mayan.__version__
|
||||
|
||||
|
||||
@@ -16,4 +16,3 @@ def render_subtemplate(context, template_name, template_context):
|
||||
new_context = Context(context)
|
||||
new_context.update(Context(template_context))
|
||||
return get_template(template_name).render(new_context)
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.http import urlquote as django_urlquote
|
||||
from django.utils.http import urlencode as django_urlencode
|
||||
from django.utils.importlib import import_module
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -87,7 +85,6 @@ def get_descriptor(file_input, read=True):
|
||||
|
||||
|
||||
def get_object_name(obj):
|
||||
ct_label = ContentType.objects.get_for_model(obj).name
|
||||
if isinstance(obj, User):
|
||||
label = obj.get_full_name() if obj.get_full_name() else obj
|
||||
else:
|
||||
|
||||
@@ -5,12 +5,11 @@ from json import dumps, loads
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.views import login, password_change
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import redirect, render_to_response
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@@ -20,7 +19,6 @@ from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
from dynamic_search.classes import SearchModel
|
||||
from permissions.models import Permission
|
||||
|
||||
from .api import tools
|
||||
from .classes import MissingItem
|
||||
@@ -33,7 +31,6 @@ from .mixins import (
|
||||
ExtraContextMixin, ObjectListPermissionFilterMixin,
|
||||
ObjectPermissionCheckMixin, RedirectionMixin, ViewPermissionCheckMixin
|
||||
)
|
||||
from .utils import return_attrib
|
||||
|
||||
|
||||
class AssignRemoveView(TemplateView):
|
||||
@@ -395,7 +392,7 @@ class ParentChildListView(ViewPermissionCheckMixin, ObjectPermissionCheckMixin,
|
||||
is_empty = len(self.object_list) == 0
|
||||
if is_empty:
|
||||
raise Http404(_("Empty list and '%(class_name)s.allow_empty' is False.")
|
||||
% {'class_name': self.__class__.__name__})
|
||||
% {'class_name': self.__class__.__name__})
|
||||
|
||||
context = self.get_context_data(object=self.object)
|
||||
return self.render_to_response(context)
|
||||
|
||||
@@ -98,23 +98,6 @@ class TextAreaDiv(forms.widgets.Widget):
|
||||
return mark_safe(result)
|
||||
|
||||
|
||||
# From: http://www.peterbe.com/plog/emailinput-html5-django
|
||||
class EmailInput(forms.widgets.Input):
|
||||
"""
|
||||
Class for a login form widget that accepts only well formated
|
||||
email address
|
||||
"""
|
||||
input_type = 'email'
|
||||
|
||||
def render(self, name, value, attrs=None):
|
||||
if attrs is None:
|
||||
attrs = {}
|
||||
attrs.update(dict(autocorrect='off',
|
||||
autocapitalize='off',
|
||||
spellcheck='false'))
|
||||
return super(EmailInput, self).render(name, value, attrs=attrs)
|
||||
|
||||
|
||||
class ScrollableCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
|
||||
"""
|
||||
Class for a form widget composed of a selection of checkboxes wrapped
|
||||
|
||||
Reference in New Issue
Block a user