Permalink
Browse files

Merge branch 'master' of github.com:oucs/time-series-api

  • Loading branch information...
2 parents a1ac6f3 + 84548de commit dcf9ee068796405edd9e4b067d975caa4d7b7138 @alexsdutton alexsdutton committed Jan 14, 2012
View
4 openorg_timeseries/models.py
@@ -153,8 +153,8 @@ def fetch(self, aggregation_type, interval, period_start=None, period_end=None):
database_client = get_client()
return database_client.fetch(self.slug, aggregation_type, interval, period_start, period_end)
- def get_absolute_url(self):
- return reverse('timeseries:detail', args=[self.slug])
+ def get_admin_url(self):
+ return reverse('timeseries-admin:detail', args=[self.slug])
object_permissions.register(['openorg_timeseries.view_timeseries',
'openorg_timeseries.append_timeseries',
View
4 openorg_timeseries/templates/timeseries-admin/index.html
@@ -19,11 +19,11 @@
</thead>
<tbody>{% for series in series %}
<tr>
- <td><a href="{{ series.get_absolute_url }}">{{ series.slug }}</a></td>
+ <td><a href="{{ series.get_admin_url }}">{{ series.slug }}</a></td>
<td>{{ series.title }}</td>
</tr>
{% endfor %}</tbody>
</table>
</article>
-{% endblock %}
+{% endblock %}
View
8 openorg_timeseries/views/admin.py
@@ -82,7 +82,7 @@ def simplify(self, value):
return map(self.simplify, value)
if isinstance(value, TimeSeries):
data = {
- '_url': value.get_absolute_url(),
+ '_url': value.get_admin_url(),
'slug': value.slug,
'title': value.title,
'notes': value.notes,
@@ -146,7 +146,7 @@ def post(self, request):
request.user.grant('openorg_timeseries.%s_timeseries' % perm, time_series)
return self.render(request,
{'status_code': 201,
- 'additional_headers': {'Location': request.build_absolute_uri(time_series.get_absolute_url())}},
+ 'additional_headers': {'Location': request.build_absolute_uri(time_series.get_admin_url())}},
'timeseries-admin/index-created')
class CreateView(TimeSeriesView, HTMLView):
@@ -184,7 +184,7 @@ def post(self, request, context):
except IntegrityError:
form.errors['slug'] = ErrorList(["A time-series with this slug already exists."])
return self.get(request, context)
- return HttpResponseSeeOther(time_series.get_absolute_url())
+ return HttpResponseSeeOther(time_series.get_admin_url())
class SecureView(View):
force_https = getattr(settings, 'FORCE_ADMIN_HTTPS', True)
@@ -256,7 +256,7 @@ def post(self, request, slug):
form.save()
if self.get_renderers(request)[0].format == 'html':
- return HttpResponseSeeOther(series.get_absolute_url())
+ return HttpResponseSeeOther(series.get_admin_url())
return self.render(request, context, 'timeseries-admin/detail-post')

0 comments on commit dcf9ee0

Please sign in to comment.