Crazyconoli
unread,Jun 23, 2011, 1:55:23 AM6/23/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to geraldo-users
class ModelAdmin(admin.ModelAdmin):
qs = QuerySet
...
and the following def within the admin:
def changelist_view(self, request, extra_context=None):
from django.contrib.admin.views.main import ChangeList
cl = ChangeList(request, self.model, list(self.list_display),
self.list_display_links, self.list_filter,
self.date_hierarchy, self.search_fields,
self.list_select_related,
self.list_per_page,
self.list_editable,
self)
ModelAdmin.qs = cl.get_query_set()
return super(ModelAdmin, self).changelist_view(request,
extra_context=extra_context)
I'm using this to generate reports with geraldo reporting as follows:
def groupreport(self, request, extra_context=None):
resp = HttpResponse(mimetype='application/pdf')
report = MOdelGroupReport(queryset=ModelAdmin.qs.extra(order_by =
['project_string','code','-pub_date']))
report.generate_by(PDFGenerator, filename=resp)
return resp
It works well on my development machine however when I deploy it on a
UWSGI server the report prints the entire queryset rather than the
current filtered queryset. Is there a better way of doing this?