瀏覽代碼

And... resolved some problems caused during the lint

Marcos Dumay de Medeiros 9 年之前
父節點
當前提交
31401eb0da
共有 6 個文件被更改,包括 15 次插入18 次删除
  1. 1 1
      src/rapid/permissions.py
  2. 2 2
      src/rapid/rapidfields.py
  3. 6 10
      src/rapid/rapidforms.py
  4. 2 1
      src/rapid/registry.py
  5. 2 2
      src/rapid/views.py
  6. 2 2
      src/rapid/wrappers.py

+ 1 - 1
src/rapid/permissions.py

@@ -11,7 +11,7 @@ from rapid.models import Application, Profile
 __author__ = 'marcos.medeiros'
 
 # noinspection PyProtectedMember
-from registry import _caller_urls_module
+from rapid.registry import _caller_urls_module
 
 
 class Permission(object):

+ 2 - 2
src/rapid/rapidfields.py

@@ -25,7 +25,7 @@ class AlternativeData(GenericForeignKey):
     Create like a Django GenericForeignKey, but use an AlternativeDataTables instead of a
     ForeignKey to ContentTypes.
     """
-    is_alternatives = True
+    is_rapid_alternatives = True
 
     def __init__(self, *args, **kwargs):
         verbose_name = kwargs.get('verbose_name')
@@ -48,7 +48,7 @@ class AlternativeDataTables(models.ForeignKey):
     Use an AlternativeDataTables model field on AlternativeData representations, instead of
     a ForeignKey with ContentTypes.
     """
-    is_alternatives = True
+    is_rapid_alternatives = True
 
     def __init__(self, alternatives=(), **kwargs):
         """

+ 6 - 10
src/rapid/rapidforms.py

@@ -5,24 +5,20 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+import collections
+
+from django import forms
 from django.contrib.contenttypes.models import ContentType
 from django.core.exceptions import ValidationError
 from django.db import transaction
-
-import gettext
 from django.utils.encoding import force_text
 
-_ = gettext.gettext
-
-__author__ = 'marcos'
-
-import collections
-
-from django import forms
-
 from rapid.widgets import RapidSelector, RapidRelationReadOnly, rapid_alternatives_widget
 from rapid.wrappers import FieldData, ModelData
 
+import gettext
+_ = gettext.gettext
+
 
 class RapidAlternativesField(forms.Field):
     def __init__(self, field_name, alternatives, selector_name, form, request, instance=None, *args, **kwargs):

+ 2 - 1
src/rapid/registry.py

@@ -8,12 +8,13 @@ from __future__ import unicode_literals
 from django.core.urlresolvers import reverse
 from django.db.utils import OperationalError
 from django.utils.encoding import python_2_unicode_compatible
-from rapid.models import Application
 from django.conf.urls import url
 import inspect
 import logging
 from os import path
 
+from rapid.models import Application
+
 
 def _split_all_path(file_name):
     file_name = path.splitdrive(file_name)[1]

+ 2 - 2
src/rapid/views.py

@@ -19,7 +19,7 @@ from rapid.models import DocumentTemplate
 from rapid.officedocs.rtf import RtfTemplate
 from rapid.wrappers import InstanceData, ModelData
 from rapid.filters import FilterSet
-from rapidforms import for_model
+from rapid.rapidforms import for_model
 
 import math
 from os import path
@@ -193,7 +193,7 @@ class ListView(generic.list.ListView):
                     return _replace_param(request, order_param, self.field.bare_name())
 
                 def order_down_url(self):
-                    return _replace_param(request, order_param, u'-' + self.field.bare_name())
+                    return _replace_param(request, order_param, '-' + self.field.bare_name())
 
                 def add_filter_url(self):
                     pass

+ 2 - 2
src/rapid/wrappers.py

@@ -303,14 +303,14 @@ class FieldData(object):
 
     def name(self):
         if self.is_auto() and self.is_relation():
-            return self.related_model().model_name_plural() + u' - ' + self.related_field().name()
+            return self.related_model().model_name_plural() + ' - ' + self.related_field().name()
         if hasattr(self.field, "verbose_name"):
             return force_text(self.field.verbose_name)
         return force_text(self.field.name)
 
     def name_plural(self):
         if self.is_auto() and self.is_relation():
-            return self.related_model().model_name_plural() + u' - ' + self.related_field().name_plural()
+            return self.related_model().model_name_plural() + ' - ' + self.related_field().name_plural()
         if hasattr(self.field, "verbose_name_plural"):
             return force_text(self.field.verbose_name_plural)
         return self.name() + "s"