Hello,
here's a django/python newbie problem, which I could not resolve after
spending some time with reading and testing.

Assuming a method in my models.py

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 following code in the views.py

def show_categories(request, col, direction):
        paginate_by = 15
        paginator =
ObjectPaginator(VMergeDocsInfo.objects.all().by_categories(),
paginate_by)

produces:
AttributeError Exception
Value: 'QuerySet' object has no attribute 'by_categories'


ok, let's go further:
def show_categories(request, col, direction):
        paginate_by = 15
        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 })


.. (what means the '[0]') after .all?) shows the paginated table in the
mentioned way but leads to another problem:
....
return render_to_response('show_categories/index.html', {'objects':
objects, 'hits' : paginator.hits })

TypeError Exception
Value: count() takes exactly one argument (0 given)
Every access to the paginator attributes results in this exception.

Where's the crux, what am I doing wrong?

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