Commits

offline committed 9729cb6

removed duplicate methods

Comments (0)

Files changed (3)

+.*\.pyc

newtags/__init__.py

Empty file added.

newtags/methods.py

     object.
     """
     ctype = ContentType.objects.get_for_model(self)
-    return Tag.objects.filter(items__content_type__pk=ctype.pk, items__object_id=self.pk)
+    return Tag.objects.filter(items__content_type=ctype, items__object_id=self.pk)
 
 
 def tag_add(self, tag_name):
             TaggedItem._default_manager.create(tag=tag, object=self)
             
             
-def get_by_model(self, tags):
-    tags = get_tag_list(tags)
-    if not tags:
-        return self.model._default_manager.none()
-    
-    return self.get_intersection_by_model(tags)
 
 
-def get_intersection_by_model(self, tags):
-    """
-    Create a ``QuerySet`` containing instances of the specified
-    model associated with *all* of the given list of tags.
-    """
-    tags = get_tag_list(tags)
-    if not tags:
-        return self.model._default_manager.none()
 
-    objects_id = set([i.id for i in self.model._default_manager.all()])
-    for tag in tags:
-        objects_id = objects_id & set([i.object_id for i in TaggedItem.objects.filter(tag=tag)])
-    return self.model._default_manager.filter(pk__in=objects_id)
-
-