From 37bf9981f8c8abd20ecce708b567d8089ed94ac1 Mon Sep 17 00:00:00 2001 From: Branson Stephens <stephenb@uwm.edu> Date: Fri, 3 May 2013 16:45:54 -0500 Subject: [PATCH] removed the getN() method from EventLog model. --- gracedb/api.py | 4 ++-- gracedb/models.py | 6 ------ gracedb/views.py | 2 +- templates/gracedb/event_detail.html | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/gracedb/api.py b/gracedb/api.py index 364996cb5..a43e03877 100644 --- a/gracedb/api.py +++ b/gracedb/api.py @@ -610,7 +610,7 @@ class EventLogList(APIView): response['Location'] = rv['self'] if tagname: - n = logentry.getN() + n = logentry.N # XXX This is not what these API views are really meant for, but... tmp = EventLogTagDetail() retval = tmp.put(request, graceid, n, tagname) @@ -660,7 +660,7 @@ def tagToDict(tag, columns=None, request=None, event=None, n=None): # Links to all log messages of the event with this tag. rv['links'] = { "logs" : [reverse("eventlog-detail", - args=[event.graceid(),log.getN()], + args=[event.graceid(),log.N], request=request) for log in event.getLogsForTag(tag.name)], "self" : reverse("eventtag-detail", diff --git a/gracedb/models.py b/gracedb/models.py index df009db73..99c1ec7e6 100644 --- a/gracedb/models.py +++ b/gracedb/models.py @@ -213,12 +213,6 @@ class EventLog(models.Model): # XXX hacky return self.filename and self.filename[-3:].lower() in ['png','gif','jpg'] - # XXX get rid of this. - def getN(self): - logset = self.event.eventlog_set.order_by("id") - logset = list(logset) - return logset.index(self) - def save(self, *args, **kwargs): success = False attempts = 0 diff --git a/gracedb/views.py b/gracedb/views.py index 98497b827..c57f162dc 100644 --- a/gracedb/views.py +++ b/gracedb/views.py @@ -481,7 +481,7 @@ def logentry(request, graceid, num=None): tag.eventlogs.add(elog) # Create a log entry to document the tag creation. - num = elog.getN() + num = elog.N msg = "Tagged message %s: %s " % (num, tagname) tlog = EventLog(event=event, issuer=request.ligouser, diff --git a/templates/gracedb/event_detail.html b/templates/gracedb/event_detail.html index b224a02ed..daaf5faee 100644 --- a/templates/gracedb/event_detail.html +++ b/templates/gracedb/event_detail.html @@ -489,7 +489,7 @@ {% for log in object|getLogsForTag:tag.name %} {% if not log.hasImage %} <tr class="{% cycle 'odd' 'even'%}"> - <td>{{log.getN}}</td> + <td>{{log.N}}</td> <td>{{log.created|multiTime:"logtime"}}</td> <td>{{log.issuer}}</td> <td>{{log.comment|sanitize}} @@ -565,7 +565,7 @@ </tr> {% for log in object.eventlog_set.iterator %} <tr class="{% cycle 'odd' 'even'%}"> - <td>{{log.getN}} + <td>{{log.N}} <td>{{log.created|multiTime:"logtime"}}</td> <td>{{log.issuer}}</td> {% if object.getAvailableTags %} -- GitLab