[perf-web] views.py: Remove duplicated code and thus add select_related
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perf-web] views.py: Remove duplicated code and thus add select_related
- Date: Tue, 29 Jul 2014 20:39:31 +0000 (UTC)
commit 224d675a11ffbd8a68b89f8d941c23ff5d142fc8
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Jul 29 22:38:25 2014 +0200
views.py: Remove duplicated code and thus add select_related
Replace code duplicated with models.py and call the models.py method
instead; this results in using the select_related() added in the
last commit for individual values as well.
metrics/views.py | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
---
diff --git a/metrics/views.py b/metrics/views.py
index c211457..afd3e3d 100644
--- a/metrics/views.py
+++ b/metrics/views.py
@@ -153,16 +153,7 @@ def values(request):
summaryCls = _SUMMARY_CLASSES[group]
if summaryCls is None:
qs = Value.objects.all()
- if start:
- qs = qs.filter(report__pull_time__gte=start)
- if end:
- qs = qs.filter(report__pull_time__lt=end)
- if target:
- qs = qs.filter(report__target__name=target.name)
- if metric:
- qs = qs.filter(metric__name=metric.name)
-
- qs = qs.order_by('metric', 'report__target', 'report__pull_time')
+ qs = Value.filter_and_order(qs, start, end, metric, target)
last_metric = None
last_target = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]