diff --git a/gracedb/settings b/gracedb/settings deleted file mode 120000 index 1aea006e66684dac4f99a8b3134ae5e473aaae3b..0000000000000000000000000000000000000000 --- a/gracedb/settings +++ /dev/null @@ -1 +0,0 @@ -/home/bmoe/gracedb/settings \ No newline at end of file diff --git a/gracedb/views.py b/gracedb/views.py index 41bfc268020c484bb4f11c612fc4ff2ec27c7eaa..55d582577755a25c6e5809633193bf00f61b2e74 100644 --- a/gracedb/views.py +++ b/gracedb/views.py @@ -9,7 +9,9 @@ from django.contrib.sites.models import Site from django.utils.html import strip_tags, escape, urlize from django.utils.safestring import mark_safe -from django.views.generic.list_detail import object_detail, object_list +# Upgrade to Django 1.5: No more function-based generic views. +#from django.views.generic.list_detail import object_list +from django.views.generic.list import ListView from django.contrib.auth.decorators import login_required from models import Event, Group, EventLog, Labelling, Label, Tag @@ -705,6 +707,33 @@ def assembleLigoLw(objects): ligolw_add.merge_compatible_tables(xmldoc) return xmldoc + +# Added for compatibility with Django 1.5. Replaced function-based generic +# views with class based generic views. There is no more 'extra_context' argument +# provided. + +class EventListView(ListView): + def __init__(self, *args, **kwargs): + # Load up the values for the extra context. + self.extra_title = kwargs.pop('title') + self.extra_form = kwargs.pop('form') + self.extra_form_action = kwargs.pop('formAction') + self.extra_max_count = kwargs.pop('maxCount') + self.extra_rawquery = kwargs.pop('rawquery') + super(EventListView, self).__init__(*args, **kwargs) + + def get_context_data(self, **kwargs): + context = super(EventListView, self).get_context_data(**kwargs) + # Insert the extra context. + context.update({ + 'title' : self.extra_title, + 'form' : self.extra_form, + 'formAction' : self.extra_form_action, + 'maxCount' : self.extra_max_count, + 'rawquery' : self.extra_rawquery, + }) + return context + def search(request, format=""): if not request.user or not request.user.is_authenticated(): return HttpResponseForbidden("Forbidden") @@ -788,14 +817,18 @@ def search(request, format=""): title = "Query Results. %s event" % objects.count() else: title = "Query Results. %s events" % objects.count() - context = { - 'title': title, - 'form': form, - 'formAction': reverse(search), - 'maxCount': limit, - 'rawquery' : rawquery, - } - return object_list(request, objects, extra_context=context) + #context = { + # 'title': title, + # 'form': form, + # 'formAction': reverse(search), + # 'maxCount': limit, + # 'rawquery' : rawquery, + #} + #return object_list(request, objects, extra_context=context) + return EventListView.as_view(queryset=objects, + template_name="gracedb/event_list.html", + title=title, form=form, formAction=reverse(search), + maxCount=limit, rawquery=rawquery).as_view() return render_to_response('gracedb/query.html', { 'form' : form, @@ -893,15 +926,20 @@ def oldsearch(request): title = "Query Results. %s event" % objects.count() else: title = "Query Results. %s events" % objects.count() - extra_context = {'title': title } textQuery = " ".join(textQuery) simple_form = SimpleSearchForm({'query': textQuery}) - extra_context['form'] = simple_form - extra_context['maxCount'] = MAX_QUERY_RESULTS - extra_context['rawquery' ] = textQuery - return object_list(request, objects, extra_context=extra_context) + #extra_context = {'title': title } + #extra_context['form'] = simple_form + #extra_context['maxCount'] = MAX_QUERY_RESULTS + #extra_context['rawquery' ] = textQuery + + #return object_list(request, objects, extra_context=extra_context) + return EventListView.as_view(queryset=objects, + template_name="gracedb/event_list.html", + title=title, form=simple_form, formAction=None, + maxCount=MAX_QUERY_RESULTS, rawquery=textQuery).as_view() return render_to_response('gracedb/query.html', diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html index 76e911a6721002ef1b8fb7547da575c2365c773d..f0d4df872c765c580427a98858b568eae7d95557 100644 --- a/templates/admin/base_site.html +++ b/templates/admin/base_site.html @@ -14,12 +14,12 @@ {% block nav-global %} <ul id="nav"> - <li id="nav-home"><a href="{% url home %}">Home</a></li> - <li id="nav-search"><a href="{% url search %}">Search</a></li> - <li id="nav-create"><a href="{% url create %}">Create</a></li> - <li id="nav-reports"><a href="{% url reports %}">Reports</a></li> - <li id="nav-feeds"><a href="{% url feeds %}">RSS</a></li> - <li id="nav-userprofile"><a href="{% url userprofile-home %}">Options</a></li> + <li id="nav-home"><a href="{% url "home" %}">Home</a></li> + <li id="nav-search"><a href="{% url "search" %}">Search</a></li> + <li id="nav-create"><a href="{% url "create" %}">Create</a></li> + <li id="nav-reports"><a href="{% url "reports" %}">Reports</a></li> + <li id="nav-feeds"><a href="{% url "feeds" %}">RSS</a></li> + <li id="nav-userprofile"><a href="{% url "userprofile-home" %}">Options</a></li> {% if user %}<li id="nav-user">Authenticated as: {{ user.first_name }} {{ user.last_name }}</li>{% endif %} <ul> diff --git a/templates/base.html b/templates/base.html index 82a670103387515a93e6938d6e4474aa23885384..9333e798e675c4f052e7df0abc1ad25cced95b8c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -30,13 +30,13 @@ function changeTime(obj, label) { {% block nav %} <ul id="nav"> - <li id="nav-home"><a href="{% url home %}">Home</a></li> - <li id="nav-search"><a href="{% url search %}">Search</a></li> - <li id="nav-create"><a href="{% url create %}">Create</a></li> - <li id="nav-reports"><a href="{% url reports %}">Reports</a></li> - <li id="nav-feeds"><a href="{% url feeds %}">RSS</a></li> - <li id="nav-latest"><a href="{% url latest %}">Latest</a></li> - <li id="nav-userprofile"><a href="{% url userprofile-home %}">Options</a></li> + <li id="nav-home"><a href="{% url "home" %}">Home</a></li> + <li id="nav-search"><a href="{% url "search" %}">Search</a></li> + <li id="nav-create"><a href="{% url "create" %}">Create</a></li> + <li id="nav-reports"><a href="{% url "reports" %}">Reports</a></li> + <li id="nav-feeds"><a href="{% url "feeds" %}">RSS</a></li> + <li id="nav-latest"><a href="{% url "latest" %}">Latest</a></li> + <li id="nav-userprofile"><a href="{% url "userprofile-home" %}">Options</a></li> {% if user %}<li id="nav-user">Authenticated as: {{ user.first_name }} {{user.last_name }}</li>{% endif %} </ul> <center> diff --git a/templates/gracedb/event_detail.html b/templates/gracedb/event_detail.html index 517b78954b6d6b89880e374958b87d8babaecb9c..a4cec88f00eaeb4bd034080ada8fada1aea9da02 100644 --- a/templates/gracedb/event_detail.html +++ b/templates/gracedb/event_detail.html @@ -224,7 +224,7 @@ //-------------------------------------------------------------------------------------------------------------------- function getTagDelCallback(tag) { return function() { - var tagUrl = "{% url taglogentry object.graceid "000" "temp" %}" + var tagUrl = "{% url "taglogentry" object.graceid "000" "temp" %}" tagUrl = tagUrl.replace("000",tag.n); tagUrl = tagUrl.replace("temp",tag.name); var tagResultDialog = new Dialog({ style: "width: 300px" }); @@ -310,7 +310,7 @@ formData = addTagForm.getValues(); var tagName = formData.existingTagSelect; var tagDispName = formData.tagDispName; - var tagUrl = "{% url taglogentry object.graceid "000" "temp" %}" + var tagUrl = "{% url "taglogentry" object.graceid "000" "temp" %}" tagUrl = tagUrl.replace("000",log.n); tagUrl = tagUrl.replace("temp",tagName); @@ -432,7 +432,7 @@ }, button_element); var savebutton = new Save({ - url: "{% url logentry object.graceid "" %}", + url: "{% url "logentry" object.graceid "" %}", onSuccess: function (resp, ioargs) { //this.inherited(resp, ioargs); this.button.set("disabled", false); @@ -543,7 +543,7 @@ <table class="event"> {% if skyalert_authorized %} <tr><td colspan="4"> - <a href="{% url skyalert object.graceid %}"><button type="button">Submit to Skyalert</button></a> + <a href="{% url "skyalert" object.graceid %}"><button type="button">Submit to Skyalert</button></a> </td></tr> {% endif %} @@ -607,7 +607,7 @@ alert("Bad neighborhood specified.") return; } - var neighborUrlPattern = "{% url neighbors object.graceid "000" %}" + var neighborUrlPattern = "{% url "neighbors" object.graceid "000" %}" var neighbor_div = dom.byId("neighbors"); neighborUrl = neighborUrlPattern.replace("000", delta); request(neighborUrl).then( @@ -632,7 +632,7 @@ <div id="new_log_entry_form"> <noscript> <h3>Create a new log entry</h3> - <form id="newlog" action="{% url logentry object.graceid "" %}" method="POST"> + <form id="newlog" action="{% url "logentry" object.graceid "" %}" method="POST"> <textarea id="newlogtext" name="comment" style="width:300px;display:block"></textarea> <input type="submit" value="Submit"/> </form> diff --git a/templates/gracedb/event_detail_GRB.html b/templates/gracedb/event_detail_GRB.html index b4ef4a118b45943cc0ff57c72bb7c71c38fc0ef8..7796130f579a305e084365091693d2c0eb901380 100644 --- a/templates/gracedb/event_detail_GRB.html +++ b/templates/gracedb/event_detail_GRB.html @@ -7,7 +7,7 @@ <table class="event"> {% if skyalert_authorized %} <tr><td colspan="4"> - <a href="{% url skyalert object.graceid %}"><button type="button">Submit to Skyalert</button></a> + <a href="{% url "skyalert" object.graceid %}"><button type="button">Submit to Skyalert</button></a> </td></tr> {% endif %} diff --git a/templates/gracedb/event_list.html b/templates/gracedb/event_list.html index 5d654f273b56742d5ec14e6ec1012e8ddbfc49ee..d3969efc992347ed156c579ab6d8c2646b29ee89 100644 --- a/templates/gracedb/event_list.html +++ b/templates/gracedb/event_list.html @@ -48,7 +48,7 @@ ( { sortable: true, - url: '{% url search %}flex?query={{rawquery|urlencode}}', + url: '{% url "search" %}flex?query={{rawquery|urlencode}}', datatype: 'json', mtype: "GET", colNames : ["UID", "Labels", "Neighbors (+/-5sec)", "Group", "Type", "Event Time", "Instruments", "FAR (Hz)", "Links", "Submitted", "Submitted By", @@ -112,8 +112,8 @@ <td> <a onClick="toggle_visibility('hints');">Hints on querying</a> {% if rawquery %} - | <a href="{% url search %}?query={{rawquery|urlencode}}">Link to current query</a> - | <a href="{% url search %}?query={{rawquery|urlencode}}&ligolw">Download LIGOLW File</a> + | <a href="{% url "search" %}?query={{rawquery|urlencode}}">Link to current query</a> + | <a href="{% url "search" %}?query={{rawquery|urlencode}}&ligolw">Download LIGOLW File</a> {% endif %} </td> </tr> @@ -144,7 +144,7 @@ <tbody> {% for obj in object_list %} <tr class={% cycle 'odd' 'even' %}> - <td><a href="{% url view obj.graceid %}">{{ obj.graceid }}</a></td> + <td><a href="{% url "view" obj.graceid %}">{{ obj.graceid }}</a></td> <td> {% for labelling in obj.labelling_set.all %} <span onmouseover="tooltip.show(tooltiptext('{{labelling.label.name}}', '{{labelling.creator.name}}', '{{labelling.created|utc}}'));" onmouseout="tooltip.hide();" style="color: {{labelling.label.defaultColor}}">{{ labelling.label.name }}</span> diff --git a/templates/gracedb/gstlalcbc_report.html b/templates/gracedb/gstlalcbc_report.html index 709199cfe3fd30642e3d7a34d702e0f790f80c5f..3429de9ce0b3b20dc8403647e7ee5ce687b0d3b8 100644 --- a/templates/gracedb/gstlalcbc_report.html +++ b/templates/gracedb/gstlalcbc_report.html @@ -96,7 +96,7 @@ onload="document.search_form.query.focus();" {% endif %} {% endfor %} <td>{{ forloop.counter }} </td> - <td><a href="{% url view obj.graceid %}">{{ obj.graceid }}</a></td> + <td><a href="{% url "view" obj.graceid %}">{{ obj.graceid }}</a></td> <td> {{ obj|end_time }} </td> <td> {{ obj.far|scientific }} </td> <td> {{ obj.instruments }} </td> diff --git a/templates/gracedb/histogram.html b/templates/gracedb/histogram.html index c3c52c61c9ee1ea5a5ecb7b9c7a3dc1b7b98d83b..f06505319750cd1262eeca7e215e04c590501cb3 100644 --- a/templates/gracedb/histogram.html +++ b/templates/gracedb/histogram.html @@ -82,7 +82,7 @@ function toggle(id) { {% block content %} <br/> -<a href="{% url gstlalcbc_report %}"><h3>Dynamic CBC Report</h3></a> +<a href="{% url "gstlalcbc_report" %}"><h3>Dynamic CBC Report</h3></a> <br/> <br/> @@ -140,6 +140,6 @@ function toggle(id) { <br/> <br/> -<a href="{% url performance %}"><h3>GraceDB 3-day performance summary</h3></a> +<a href="{% url "performance" %}"><h3>GraceDB 3-day performance summary</h3></a> {% endblock %} diff --git a/templates/gracedb/index.html b/templates/gracedb/index.html index bd87b3857210a26f54419a5059619f943781f013..3003a53599cfedbb5ae39a4e8a8f12f86c4ba3fd 100644 --- a/templates/gracedb/index.html +++ b/templates/gracedb/index.html @@ -26,7 +26,7 @@ You can read about using the service on the <div class="text"> To receive email alerts when GraCEDb events are created, sign up on the <a target="_blank" href="http://listserv.ligo.org/cgi-bin/mailman/listinfo/gracedb">gracedb mailing list</a> or set up your own alert under the -<a href="{% url userprofile-home %}">Options</a> menu item. +<a href="{% url "userprofile-home" %}">Options</a> menu item. </div> {% endblock %} diff --git a/templates/gracedb/latest.html b/templates/gracedb/latest.html index 11aad2ac4196b62bed9a51a122039ab58d20f5bb..12a78557117c6fe259bd97b10032f66e2d3e00f3 100644 --- a/templates/gracedb/latest.html +++ b/templates/gracedb/latest.html @@ -11,7 +11,7 @@ {% block jscript %} {% if not error %} - <meta http-equiv="refresh" content="300;url={% url latest %}/?query={{rawquery|urlencode}}"> + <meta http-equiv="refresh" content="300;url={% url "latest" %}/?query={{rawquery|urlencode}}"> {% endif %} {# http/https depending on this pages' protocol #} @@ -98,7 +98,7 @@ <table class="event"> {% if skyalert_authorized %} <tr><td colspan="4"> - <a href="{% url skyalert object.graceid %}"><button type="button">Submit to Skyalert</button></a> + <a href="{% url "skyalert" object.graceid %}"><button type="button">Submit to Skyalert</button></a> </td></tr> {% endif %} @@ -123,7 +123,7 @@ {% for object in objects %} <tr class={% cycle 'odd' 'even' %}> - <td><a href="{% url view object.graceid %}">{{ object.graceid }}</a></td> + <td><a href="{% url "view" object.graceid %}">{{ object.graceid }}</a></td> <td> {% for labelling in object.labelling_set.all %} <span title="{{labelling.creator.name}} {{labelling.created|utc}}" style="color: {{labelling.label.defaultColor}}">{{ labelling.label.name }}</span> diff --git a/templates/gracedb/latest_public.html b/templates/gracedb/latest_public.html index 59184781d007f2014cdf33decdd50c69f1d37455..833eef2d0dc3f0b499ec4a5e1127185795a9175a 100644 --- a/templates/gracedb/latest_public.html +++ b/templates/gracedb/latest_public.html @@ -11,7 +11,7 @@ {% block jscript %} {% if not error %} - <meta http-equiv="refresh" content="300;url={% url latest %}/?query={{rawquery|urlencode}}"> + <meta http-equiv="refresh" content="300;url={% url "latest" %}/?query={{rawquery|urlencode}}"> {% endif %} {# http/https depending on this pages' protocol #} diff --git a/templates/gracedb/neighbors_frag.html b/templates/gracedb/neighbors_frag.html index 40b12aec3c20b1078db704bd17c9828371605b78..4698c7821da7b3c731c4149e114d5e2f8cea5f15 100644 --- a/templates/gracedb/neighbors_frag.html +++ b/templates/gracedb/neighbors_frag.html @@ -30,7 +30,7 @@ </tr> {% for delta, object in nearby %} <tr class={% cycle 'odd' 'even' %}> - <td><a href="{% url view object.graceid %}">{{ object.graceid }}</a></td> + <td><a href="{% url "view" object.graceid %}">{{ object.graceid }}</a></td> <td> {% for labelling in object.labelling_set.all %} <span onmouseover="tooltip.show(tooltiptext('{{labelling.label.name}}', '{{labelling.creator.name}}', '{{labelling.created|utc}}'));" onmouseout="tooltip.hide();" style="color: {{labelling.label.defaultColor}}">{{ labelling.label.name }}</span> diff --git a/templates/profile/notifications.html b/templates/profile/notifications.html index ea4105918b918c6b2b5549c9ba768ffeab1174e9..100bb45ce0c6c57fe39f1572f10082df7491963f 100644 --- a/templates/profile/notifications.html +++ b/templates/profile/notifications.html @@ -9,26 +9,26 @@ {% for trigger in triggers %} <ul> <li> - <!-- <a href="{% url userprofile-edit trigger.id %}">Edit</a> --> - <a href="{% url userprofile-delete trigger.id %}">Delete</a> + <!-- <a href="{% url "userprofile-edit" trigger.id %}">Edit</a> --> + <a href="{% url "userprofile-delete" trigger.id %}">Delete</a> {{ trigger.userlessDisplay }} </li> </ul> {% endfor %} -<a href="{% url userprofile-create %}">Create New Notification</a> +<a href="{% url "userprofile-create" %}">Create New Notification</a> <h2>Contacts</h2> {% for contact in contacts %} <ul> <li> - <!-- <a href="{% url userprofile-edit-contact contact.id %}">Edit</a> --> - <a href="{% url userprofile-delete-contact contact.id %}">Delete</a> + <!-- <a href="{% url "userprofile-edit-contact" contact.id %}">Edit</a> --> + <a href="{% url "userprofile-delete-contact" contact.id %}">Delete</a> {{ contact.desc }} / {{ contact.email }} </li> </ul> {% endfor %} -<a href="{% url userprofile-create-contact %}">Create New Contact</a> +<a href="{% url "userprofile-create-contact" %}">Create New Contact</a> {% endblock %} diff --git a/templates/rest_framework/api.html b/templates/rest_framework/api.html index e89675deafff261fd4fcb2150a80479b213e8f1e..66e196a072961428fdf3864b4c96d1172afb498b 100644 --- a/templates/rest_framework/api.html +++ b/templates/rest_framework/api.html @@ -17,7 +17,7 @@ GraceDB — REST API {% block breadcrumbs %} <ul class="breadcrumb"> - <li><a href="{% url home %}">Home</a></li><span class="divider">›</span> + <li><a href="{% url "home" %}">Home</a></li><span class="divider">›</span> {% for breadcrumb_name, breadcrumb_url in breadcrumblist %} <li> <a href="{{ breadcrumb_url }}" {% if forloop.last %}class="active"{% endif %}>{{ breadcrumb_name }}</a> {% if not forloop.last %}<span class="divider">›</span>{% endif %}