From 67ca90d881dc340fee04ca5fdf2ea75a9c2df391 Mon Sep 17 00:00:00 2001 From: Brian Moe <bmoe@gravity.phys.uwm.edu> Date: Sat, 4 Jul 2009 23:03:50 -0500 Subject: [PATCH] First cut at approvals. Changed alert filename to file URL. --- gracedb/forms.py | 4 ++++ gracedb/models.py | 9 ++++++++- gracedb/views.py | 5 +++++ templates/gracedb/event_list.html | 22 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gracedb/forms.py b/gracedb/forms.py index 0369f6d0e..ca54bbae7 100644 --- a/gracedb/forms.py +++ b/gracedb/forms.py @@ -22,3 +22,7 @@ class EventSearchForm(forms.Form): group = forms.ChoiceField(choices=groupChoices, required=False) type = forms.ChoiceField(choices=typeChoices, required=False) submitter = forms.ChoiceField(choices=submitterChoices, required=False) + + ligoApproved = forms.BooleanField(initial=False, required=False, label="LIGO Approved Only") + virgoApproved = forms.BooleanField(initial=False, required=False, label="Virgo Approved Only") + diff --git a/gracedb/models.py b/gracedb/models.py index 8401cf0f9..41b93c771 100755 --- a/gracedb/models.py +++ b/gracedb/models.py @@ -95,7 +95,14 @@ class Event(models.Model): return "https://www.lsc-group.phys.uwm.edu/twiki/bin/view/Sandbox/%s" % self.uid def clusterurl(self): - return "pcdev1.phys.uwm.edu:/archive/gracedb/data/%s" % self.uid + #return "pcdev1.phys.uwm.edu:/archive/gracedb/data/%s" % self.uid + return "file://pcdev1.phys.uwm.edu/archive/gracedb/data/%s" % self.uid + + def ligoApproved(self): + return self.approval_set.filter(approvingCollaboration='L').count() + + def virgoApproved(self): + return self.approval_set.filter(approvingCollaboration='V').count() class Approval(models.Model): COLLABORATION_CHOICES = ( ('L','LIGO'), ('V','Virgo'), ) diff --git a/gracedb/views.py b/gracedb/views.py index a432ec1bd..3613da24d 100755 --- a/gracedb/views.py +++ b/gracedb/views.py @@ -114,6 +114,11 @@ def search(request): objects = objects.filter(group=group) if typename: objects = objects.filter(analysisType=typename) + if form.cleaned_data['ligoApproved']: + objects = objects.filter(approval__approvingCollaboration='L') + + if form.cleaned_data['virgoApproved']: + objects = objects.filter(approval__approvingCollaboration='V') return object_list(request, objects, extra_context={'title':"Query Results"}) diff --git a/templates/gracedb/event_list.html b/templates/gracedb/event_list.html index 5134af4a2..0309d9c13 100644 --- a/templates/gracedb/event_list.html +++ b/templates/gracedb/event_list.html @@ -8,7 +8,11 @@ {% if object_list.count %} <table> + <tr> <th colspan="2">Approvals</th> + </tr> <tr> + <th>LIGO</th> + <th>Virgo</th> <th>UID</th> <th>Submitter</th> <th>Group</th> @@ -19,6 +23,24 @@ {% for obj in object_list %} <tr class={% cycle 'odd' 'even' %}> + <!-- + https://archie.phys.uwm.edu/media/img/admin/icon-no.gif + https://archie.phys.uwm.edu/media/img/admin/icon-yes.gif + --> + <td align="center"> + {% if obj.ligoApproved %} + <img src="/media/img/admin/icon-yes.gif"/> + {% else %} + <img src="/media/img/admin/icon-no.gif"/> + {% endif %} + </td> + <td align="center"> + {% if obj.virgoApproved %} + <img src="/media/img/admin/icon-yes.gif"/> + {% else %} + <img src="/media/img/admin/icon-no.gif"/> + {% endif %} + </td> <td>{{ obj.uid }}</td> <td>{{ obj.submitter }} </td> <td>{{ obj.group }} </td> -- GitLab