hi,
some newbie questions here... after spending much time with
reading/testing I still have no solution; some help is needed and
appreciated.
here's the problem:

having a class definition with a custom sql statement:

class VMergeDocsInfo(models.Model):
....
        def by_categories(self):
                from django.db import connection
                cursor = connection.cursor()
                cursor.execute("SELECT DISTINCT doc_title FROM t_merge_docs")
                return [row for row in cursor.fetchall()]
......

... and a view definition with:
        paginate_by = 15
        paginator =
ObjectPaginator(VMergeDocsInfo.objects.all().by_categories(),
paginate_by)

results in:
AttributeError
Exception Value:        'QuerySet' object has no attribute 'by_categories'


following is ok:
        paginator =
ObjectPaginator(VMergeDocsInfo.objects.all()[0].by_categories(),
paginate_by)
        objects = paginator.get_page(page)
        return render_to_response('show_categories/index.html', {'objects':
objects})

but now comes the next problem:
return render_to_response('show_categories/index.html', {'objects':
objects, 'hits' : paginator.hits})
produces
TypeError
Exception Value:        count() takes exactly one argument (0 given)

why? what's wrong with the paginator?

thank you in advance,
robert


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to