(self, queryset_or_model, tags)
return queryset.extra(
            tables=[opts.db_table],
            where=[
                '%s.content_type_id = %%s' % tagged_item_table,
                '%s.tag_id = %%s' % tagged_item_table,
                '%s.%s = %s.object_id' % (qn(model._meta.db_table),
                                          qn(model._meta.pk.column),
                                          tagged_item_table)
            ],
            params=[content_type.pk, tag.pk],
        )
Create a ``QuerySet`` containing instances of the specified
        model associated with a given tag or list of tags.
Create a ``QuerySet`` containing instances of the specified
        model associated with a given tag or list of tags.
Create a QuerySet containing instances of the specified model associated with a given tag or list of tags .
def get_by_model(self, queryset_or_model, tags):
        """
        Create a ``QuerySet`` containing instances of the specified
        model associated with a given tag or list of tags.
        """
        tags = get_tag_list(tags)
        tag_count = len(tags)
        if tag_count == 0:
            # No existing tags were given
            queryset, model = get_queryset_and_model(queryset_or_model)
            return model._default_manager.none()
        elif tag_count == 1:
            # Optimisation for single tag - fall through to the simpler
            # query below.
            tag = tags[0]
        else:
            return self.get_intersection_by_model(queryset_or_model, tags)

        queryset, model = get_queryset_and_model(queryset_or_model)
        content_type = ContentType.objects.get_for_model(model)
        opts = self.model._meta
        tagged_item_table = qn(opts.db_table)
        return queryset.extra(
            tables=[opts.db_table],
            where=[
                '%s.content_type_id = %%s' % tagged_item_table,
                '%s.tag_id = %%s' % tagged_item_table,
                '%s.%s = %s.object_id' % (qn(model._meta.db_table),
                                          qn(model._meta.pk.column),
                                          tagged_item_table)
            ],
            params=[content_type.pk, tag.pk],
        )
def get_by_model ( self , queryset_or_model , tags ) : tags = get_tag_list ( tags ) tag_count = len ( tags ) if tag_count == 0 : # No existing tags were given queryset , model = get_queryset_and_model ( queryset_or_model ) return model . _default_manager . none ( ) elif tag_count == 1 : # Optimisation for single tag - fall through to the simpler # query below. tag = tags [ 0 ] else : return self . get_intersection_by_model ( queryset_or_model , tags ) queryset , model = get_queryset_and_model ( queryset_or_model ) content_type = ContentType . objects . get_for_model ( model ) opts = self . model . _meta tagged_item_table = qn ( opts . db_table ) return queryset . extra ( tables = [ opts . db_table ] , where = [ '%s.content_type_id = %%s' % tagged_item_table , '%s.tag_id = %%s' % tagged_item_table , '%s.%s = %s.object_id' % ( qn ( model . _meta . db_table ) , qn ( model . _meta . pk . column ) , tagged_item_table ) ] , params = [ content_type . pk , tag . pk ] , )