~carljm/django-tagging/tagfield-signal-updates

« back to all changes in this revision

Viewing changes to tagging/models.py

  • Committer: jonathan.buchanan
  • Date: 2008-10-30 02:17:55 UTC
  • Revision ID: vcs-imports@canonical.com-20081030021755-zp1ua9wkvmt46c1d
Got tests back in working order; documentation updates for Django 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
267
267
          objects we're interested in, then use the ORM's ``__in``
268
268
          lookup to return a ``QuerySet``.
269
269
 
270
 
          now that the queryset-refactor branch is in the trunk, this can be
 
270
          Now that the queryset-refactor branch is in the trunk, this can be
271
271
          tidied up significantly.
272
272
    """
273
273
    def get_by_model(self, queryset_or_model, tags):
419
419
            'tag': qn(self.model._meta.get_field('tag').rel.to._meta.db_table),
420
420
            'content_type_id': content_type.pk,
421
421
            'related_content_type_id': related_content_type.pk,
422
 
            'limit_offset': num is not None and connection.ops.limit_offset_sql(num) or '',
 
422
            # Hardcoding this for now just to get tests working again - this
 
423
            # should now be handled by the query object.
 
424
            'limit_offset': num is not None and 'LIMIT %s' or '',
423
425
        }
424
426
 
425
427
        cursor = connection.cursor()
426
 
        cursor.execute(query, [obj.pk])
 
428
        params = [obj.pk]
 
429
        if num is not None:
 
430
            params.append(num)
 
431
        cursor.execute(query, params)
427
432
        object_ids = [row[0] for row in cursor.fetchall()]
428
433
        if len(object_ids) > 0:
429
434
            # Use in_bulk here instead of an id__in lookup, because id__in would