From 3f290349aae14dfc5251bca815ee2872454d8c76 Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Thu, 18 Jun 2009 06:53:52 +0100 Subject: [svn] Adding logbook export features. Troggle can now produce .txt or .html logbooks through the controlPanel or via an action in the LogbookEntry admin pages. --- expo/admin.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'expo/admin.py') diff --git a/expo/admin.py b/expo/admin.py index e4863b1..e88e1cd 100644 --- a/expo/admin.py +++ b/expo/admin.py @@ -6,6 +6,7 @@ import django.forms as forms from expo.forms import LogbookEntryForm from django.http import HttpResponse from django.core import serializers +from expo.views_other import downloadLogbook #from troggle.reversion.admin import VersionAdmin #django-reversion version control #overriding admin save so we have the new since parsing field @@ -50,6 +51,16 @@ class LogbookEntryAdmin(TroggleModelAdmin): date_heirarchy = ('date') inlines = (PersonTripInline, PhotoInline, QMsFoundInline) form = LogbookEntryForm + + actions=('export_logbook_entries_as_html','export_logbook_entries_as_txt') + + def export_logbook_entries_as_html(modeladmin, request, queryset): + response=downloadLogbook(request=request, queryset=queryset, extension='html') + return response + + def export_logbook_entries_as_txt(modeladmin, request, queryset): + response=downloadLogbook(request=request, queryset=queryset, extension='txt') + return response class PersonExpeditionInline(admin.TabularInline): model = PersonExpedition -- cgit v1.2.3