Permalink
Browse files

Take code out of __init__.py

  • Loading branch information...
paltman committed Nov 2, 2011
1 parent 7970bc3 commit 18bb14b83ec77dd8e64c465df7a02b898f68879b
Showing with 13 additions and 16 deletions.
  1. +0 −1 docs/index.rst
  2. +2 −2 docs/usage.rst
  3. +0 −3 partitions/__init__.py
  4. +0 −9 partitions/registry.py
  5. +1 −1 partitions/templatetags/partitions_tags.py
  6. +10 −0 partitions/utils.py
View
@@ -20,6 +20,5 @@ Contents
changelog
installation
templatetags
- settings
usage
View
@@ -10,7 +10,7 @@ register function::
from django.db.models import Q
- from partitions import register
+ from partitions.registry import register
register("partner-a.mycompany.com", "products.Product", Q(partner__slug="partner-a"))
@@ -35,7 +35,7 @@ function directly::
from products.models import Product
- from partitions import chop
+ from partitions.utils import chop
def product_list(request):
View
@@ -1,4 +1 @@
__version__ = "0.1.dev1"
-
-
-from partitions.registry import register, partition
View
@@ -29,12 +29,3 @@ def expression_for(self, key, app_model):
def register(key, app_model, expression):
registry.register(key, app_model, expression)
-
-
-def chop(queryset, by):
- app_model = "%s.%s" % (
- queryset.model._meta.app_label,
- queryset.model._meta.object_name
- )
- expression = registry.expression_for(by, app_model)
- return queryset.filter(expression) if expression is not None else queryset
@@ -1,6 +1,6 @@
from django import template
-from partitions import chop
+from partitions.utils import chop
register = template.Library()
View
@@ -0,0 +1,10 @@
+from partitions.registry import registry
+
+
+def chop(queryset, by):
+ app_model = "%s.%s" % (
+ queryset.model._meta.app_label,
+ queryset.model._meta.object_name
+ )
+ expression = registry.expression_for(by, app_model)
+ return queryset.filter(expression) if expression is not None else queryset

0 comments on commit 18bb14b

Please sign in to comment.