Permalink
Browse files

Added test data and tweaked metadata update in admin.

  • Loading branch information...
1 parent 8b57983 commit 04cbd7a4ff65157def76b8b1b9c3520a6855ec5b @alexsdutton alexsdutton committed Jan 15, 2012
View
2 openorg_timeseries/templates/timeseries-admin/create.html
@@ -1,5 +1,7 @@
{% extends "timeseries-admin/base.html" %}
+{% block title %}Create a new time-series{% endblock %}
+
{% block content %}
<h1>Create new time-series</h1>
View
4 openorg_timeseries/tests/data/test_data.csv
@@ -0,0 +1,4 @@
+1970-01-01T01:30:00+01:00,5
+1970-01-01T02:00:00+01:00,10
+1970-01-01T02:30:00+01:00,15
+1970-01-01T03:00:00+01:00,20
View
7 openorg_timeseries/views/admin.py
@@ -246,7 +246,7 @@ def post(self, request, slug):
'appended': result['appended'],
'last': result['last']}
- editable_fields = ('title', 'notes')
+ editable_fields = ('title', 'notes', 'is_public')
if request.json_data and any(f in request.json_data for f in editable_fields):
context['updated'] = []
if not self.has_perm('change', series):
@@ -262,15 +262,16 @@ def post(self, request, slug):
if form.is_valid():
if not self.has_perm('change', series):
return self.lacking_privilege("modify this time-series")
+ context['update-successful'] = True
form.save()
if successful and self.get_renderers(request)[0].format == 'html':
query = {}
if 'readings' in context:
query.update({'readings.count': context['readings']['count'],
'readings.appended': context['readings']['appended']})
- if 'updated' in context:
- query['updated'] = ','.join(context['updated'])
+ if context.get('update-successful'):
+ query['updated'] = 'true'
return HttpResponseSeeOther('%s?%s' % (series.get_admin_url(), urllib.urlencode(query)))
context['status_code'] = httplib.OK if successful else httplib.BAD_REQUEST

0 comments on commit 04cbd7a

Please sign in to comment.