From 56df8a8a8d7088a56eaf2d87f96929336be984fb Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 3 Mar 2014 17:06:07 +0100 Subject: [PATCH] fix crem hidden fields, add output param to revision plot --- telemeta/cache.py | 2 +- telemeta/forms/media.py | 4 +++- .../commands/telemeta-export-item-revisions-plot.py | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/telemeta/cache.py b/telemeta/cache.py index 02a2a842..ea484add 100644 --- a/telemeta/cache.py +++ b/telemeta/cache.py @@ -128,6 +128,6 @@ class TelemetaCache(object): node.setAttribute('name', name) node.setAttribute('id', id) node.setAttribute('unit', unit) - node.setAttribute('value', str(value)) + node.setAttribute('value', unicode(value)) root.appendChild(node) return xml.dom.minidom.Document.toprettyxml(doc) diff --git a/telemeta/forms/media.py b/telemeta/forms/media.py index a506f438..2d3e05da 100644 --- a/telemeta/forms/media.py +++ b/telemeta/forms/media.py @@ -71,7 +71,9 @@ class MediaItemForm(ModelForm): class Meta: model = MediaItem - exclude = ('copied_from_item',) + exclude = ('copied_from_item', 'scientist', 'topic', 'summary', 'contributor', + 'organization', 'depositor', 'rights', 'recordist', 'digitalist', + 'digitization_date', 'publishing_date', ) def clean_code(self): return self.cleaned_data['code'] or None diff --git a/telemeta/management/commands/telemeta-export-item-revisions-plot.py b/telemeta/management/commands/telemeta-export-item-revisions-plot.py index 6a0a513c..1049c3d2 100644 --- a/telemeta/management/commands/telemeta-export-item-revisions-plot.py +++ b/telemeta/management/commands/telemeta-export-item-revisions-plot.py @@ -39,7 +39,11 @@ class Command(BaseCommand): make_option('-d', '--day', dest='day', help='day of the first revision'), + make_option('-o', '--output', + dest='output', + help='directory output'), ) + def group(self, di): return int(calendar.timegm(di.timetuple()))/self.binning @@ -50,6 +54,7 @@ class Command(BaseCommand): mondays = mdates.WeekdayLocator(mdates.MONDAY) monthsFmt = mdates.DateFormatter("%b '%y") yearsFmt = mdates.DateFormatter('%Y') + output = kwargs.get('output') revisions = Revision.objects.filter(time__gte=limit_date) list_of_dates = [r.time for r in revisions] @@ -70,8 +75,8 @@ class Command(BaseCommand): ax.grid(True) fig.autofmt_xdate() - plt.savefig('/tmp/telemeta-revisions.png') - plt.savefig('/tmp/telemeta-revisions.pdf') + plt.savefig(output + os.sep + 'telemeta-revisions.png') + plt.savefig(output + os.sep + 'telemeta-revisions.pdf') #plt.show() -- 2.39.5