Commit 2051abeb authored by Tanner Prestegard's avatar Tanner Prestegard
Browse files

Merge branch 'Django_1.11.5_upgrade' into 'master'

Django 1.11.5 upgrade

See merge request !5
parents 94cb2209 64e38163
from django.http import HttpResponse, HttpResponseNotFound
from django.http import HttpResponseForbidden, HttpResponseServerError
from django.core.urlresolvers import reverse as django_reverse
from django.urls import reverse as django_reverse
from django.conf import settings
from django.utils.functional import wraps
......
......@@ -23,7 +23,7 @@ from VOEventLib.VOEvent import Time, TimeInstant
from utils import gpsToUtc
from django.utils import timezone
from django.conf import settings
from django.core.urlresolvers import reverse
from django.urls import reverse
from models import CoincInspiralEvent, MultiBurstEvent
from models import VOEvent as GraceDBVOEvent
from models import LalInferenceBurstEvent
......
......@@ -2,9 +2,9 @@
from django.contrib.syndication.views import FeedDoesNotExist
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.shortcuts import render
from models import Event, Group, Pipeline
#from views import view, search, index
......@@ -79,7 +79,4 @@ class EventFeed(Feed):
@internal_user_required
def feedview(request):
return render_to_response(
'feeds/index.html',
{},
context_instance=RequestContext(request))
return render(request, 'feeds/index.html')
from django.db import models, IntegrityError
from django.core.urlresolvers import reverse
from django.urls import reverse
from model_utils.managers import InheritanceManager
......
from django.http import HttpResponseForbidden
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.shortcuts import render
from django.conf import settings
from gracedb.models import Event, Group, Search
......@@ -9,7 +9,7 @@ from gracedb.permission_utils import filter_events_for_user
from gracedb.permission_utils import internal_user_required
from django.db.models import Q
from django.core.urlresolvers import reverse
from django.urls import reverse
from models import CoincInspiralEvent
from forms import SimpleSearchForm
......@@ -62,8 +62,8 @@ def histo(request):
except:
binned_counts = None
return render_to_response(
'gracedb/histogram.html',
return render(request, 'gracedb/histogram.html',
context=
{'table': table,
#'ifar' : ifar,
#'uptime' : uptime,
......@@ -71,8 +71,8 @@ def histo(request):
#'rate' : rate_info,
'binned_counts': binned_counts,
'url_prefix' : settings.REPORT_INFO_URL_PREFIX,
},
context_instance=RequestContext(request))
}
)
#def rate_data(request):
def rate_data():
......@@ -180,9 +180,8 @@ def cbc_report(request, format=""):
errormsg = 'Your query returned items that are not CoincInspiral Events. '
errormsg += 'Please try again.'
form = SimpleSearchForm()
return render_to_response('gracedb/cbc_report.html',
{ 'form':form, 'message':errormsg},
context_instance=RequestContext(request))
return render(request, 'gracedb/cbc_report.html',
context={'form': form, 'message': errormsg})
# Check that we have a well-defined GPS time range.
# Find the gpstime limits of the query by diving into the query object.
......@@ -198,25 +197,23 @@ def cbc_report(request, format=""):
# Bounce back to the user with an error message
errormsg = 'Your query does not have a gpstime range. Please try again.'
form = SimpleSearchForm()
return render_to_response('gracedb/cbc_report.html',
{ 'form':form, 'message':errormsg},
context_instance=RequestContext(request))
return render(request, 'gracedb/cbc_report.html', context=
{'form': form, 'message': errormsg})
lt = int(gpsrange[1]) - int(gpsrange[0])
# Check that there aren't too many objects.
# XXX Hardcoded limit
if objects.count() > 2000:
errormsg = 'Your query returned too many events. Please try again.'
return render_to_response('gracedb/cbc_report.html',
{ 'form':form, 'message':errormsg},
context_instance=RequestContext(request))
return render(request, 'gracedb/cbc_report.html', context=
{'form': form, 'message': errormsg})
# Zero events will break the min/max over masses below.
if objects.count() < 1:
errormsg = 'Your query returned no events. Please try again.'
return render_to_response('gracedb/cbc_report.html',
{ 'form':form, 'message':errormsg},
context_instance=RequestContext(request))
return render(request, 'gracedb/cbc_report.html', context=
{'form': form, 'message': errormsg})
#clustered_events = cluster(objects)
clustered_events = cluster(object_list)
......@@ -309,10 +306,6 @@ def cbc_report(request, format=""):
'ifar_plot' : ifar_plot,
'clustered_events' : clustered_events,
}
return render_to_response('gracedb/cbc_report.html', context,
context_instance=RequestContext(request))
return render(request, 'gracedb/cbc_report.html', context=context)
return render_to_response('gracedb/cbc_report.html',
{ 'form' : form,
},
context_instance=RequestContext(request))
return render(request, 'gracedb/cbc_report.html', context={'form': form})
"""
To function this requires the following to be installed:
TEMPLATE_CONTEXT_PROCESSORS
django.core.context_processors.request
MIDDLEWARE_CLASSES
django.contrib.sessions.middleware.SessionMiddleware
@author: Robert Conner (rtconner)
"""
# It's pretty simple. Do something like this in your view ..
# >>>request.session['flash_msg'] = 'Your changes have been save'
# >>>request.session['flash_params'] = {'type': 'success'}
# And maybe put something like this in your template
#
# {% load flash %}
# {% flash %}
# <h2>{{ params.type }}</h2>
# {{ msg }}
# {% endflash %}
# It also support a flash template, you can specify a file FLASH_TEMPLATE in
# your settings file and then that file will be rendered with msg and params as
# available variable. Usage for this would simply be {% flash_template %} and
# then you gotta make a template file that does whatever you like.
# Outside of that just be aware you need the Django session middleware and
# request context installed in your app to use this.
from django import template
from django.template import resolve_variable, Context
from datetime import timedelta
from django.utils import timezone
from django.template.loader import render_to_string
from django.contrib.sessions.models import Session
from django.conf import settings
register = template.Library()
def session_clear(session):
"""
Private function, clear flash msgsfrom the session
"""
try:
del session['flash_msg']
except KeyError:
pass
try:
del session['flash_params']
except KeyError:
pass
# Save changes to session
if(session.session_key):
Session.objects.save(session.session_key, session._session,
timezone.now() + timedelta(seconds=settings.SESSION_COOKIE_AGE))
class RunFlashBlockNode(template.Node):
def __init__(self, nodelist):
self.nodelist = nodelist
def render(self, context):
session = context['request'].session
ret = None
if session.get('flash_msg', False):
ret = {'msg': session['flash_msg']}
if 'flash_params' in session:
ret['params'] = session.get('flash_params', False)
session_clear(session);
if ret is not None:
context.update(ret)
return self.nodelist.render(context)
return ''
class RunFlashTemplateNode(template.Node):
def __init__(self):
pass
def render(self, context):
session = context['request'].session
if session.get('flash_msg', False):
ret = {'msg': session['flash_msg']}
if 'flash_params' in session:
ret['params'] = session.get('flash_params', False)
session_clear(session);
try:
template = settings.FLASH_TEMPLATE
except AttributeError:
template = 'elements/flash.html'
return render_to_string(template, dictionary=ret)
return ''
@register.tag(name="flash_template")
def do_flash_template(parser, token):
"""
Call template if there is flash message in session
Runs a check if there is a flash message in the session.
If the flash message exists it calls settings.FLASH_TEMPLATE
and passes the template the variables 'msg' and 'params'.
Calling this clears the flash from the session automatically
To set a flash msg, in a view call:
request.session['flash_msg'] = 'sometihng'
request.session[flash_'params'] = {'note': 'remember me'}
In the template {{ msg }} and {{ params.note }} are available
"""
return RunFlashTemplateNode()
@register.tag(name="flash")
def do_flash_block(parser, token):
"""
A block section where msg and params are both available.
Calling this clears the flash from the session automatically
If there is no flash msg, then nothing inside this block
gets rendered
Example:
{% flash %}
{{msg}}<br />
{{params.somekey}}
{% endflash %}
"""
nodelist = parser.parse(('endflash',))
parser.delete_first_token()
return RunFlashBlockNode(nodelist)
# Changed for Django 1.6
#from django.conf.urls.defaults import *
#from django.conf.urls import patterns, url, include
from django.conf.urls import patterns, url
# Changed for Django 1.11
from django.conf.urls import url
# Import views
from . import views
#import django.views.generic.list_detail
from gracedb.api import download
urlpatterns = patterns('gracedb.views',
url (r'^$', 'index', name="home-events"),
url (r'^create/$', 'create', name="create"),
url (r'^search/(?P<format>(json|flex))?$', 'search', name="search"),
url (r'^view/(?P<graceid>[GEHMT]\d+)', 'view', name="view"),
url (r'^voevent/(?P<graceid>[GEHMT]\d+)', 'voevent', name="voevent"),
# url (r'^skyalert/(?P<graceid>[GEHMT]\d+)', 'skyalert', name="skyalert"),
url (r'^neighbors/(?P<graceid>[GEHMT]\d+)/\(?(?P<delta1>[-+]?\d+)(,(?P<delta2>[-+]?\d+)\)?)?', 'neighbors', name="neighbors"),
url (r'^(?P<graceid>[GEHMT]\d+)$', 'view', name="view2"),
url (r'^(?P<graceid>[GEHMT]\d+)/t90/$', 'modify_t90', name="modify_t90"),
url (r'^(?P<graceid>[GEHMT]\d+)/perms/$', 'modify_permissions', name="modify_permissions"),
url (r'^(?P<graceid>[GEHMT]\d+)/signoff/$', 'modify_signoff', name="modify_signoff"),
url (r'^(?P<graceid>[GEHMT]\d+)/files/$', 'file_list', name="file_list"),
url (r'^(?P<graceid>[GEHMT]\d+)/files/(?P<filename>.*)$', download, name="file"),
url (r'^(?P<graceid>[GEHMT]\d+)/log/(?P<num>([\d]*|preview))$', 'logentry', name="logentry"),
url (r'^(?P<graceid>[GEHMT]\d+)/embblog/(?P<num>([\d]*|preview))$', 'embblogentry', name="embblogentry"),
url (r'^(?P<graceid>[GEHMT]\d+)/emobservation/(?P<num>([\d]*|preview))$', 'emobservation_entry', name="emobservation_entry"),
url (r'^(?P<graceid>[GEHMT]\d+)/log/(?P<num>\d+)/tag/(?P<tagname>.*)$', 'taglogentry', name="taglogentry"),
urlpatterns = [
url(r'^$', views.index, name="home-events"),
url(r'^create/$', views.create, name="create"),
url(r'^search/(?P<format>(json|flex))?$', views.search, name="search"),
url(r'^view/(?P<graceid>[GEHMT]\d+)', views.view, name="view"),
url(r'^voevent/(?P<graceid>[GEHMT]\d+)', views.voevent, name="voevent"),
#url (r'^skyalert/(?P<graceid>[GEHMT]\d+)', 'skyalert', name="skyalert"),
url((r'^neighbors/(?P<graceid>[GEHMT]\d+)/\(?(?P<delta1>[-+]?\d+)'
'(,(?P<delta2>[-+]?\d+)\)?)?'), views.neighbors, name="neighbors"),
url(r'^(?P<graceid>[GEHMT]\d+)$', views.view, name="view2"),
url(r'^(?P<graceid>[GEHMT]\d+)/t90/$', views.modify_t90,
name="modify_t90"),
url(r'^(?P<graceid>[GEHMT]\d+)/perms/$', views.modify_permissions,
name="modify_permissions"),
url(r'^(?P<graceid>[GEHMT]\d+)/signoff/$', views.modify_signoff,
name="modify_signoff"),
url(r'^(?P<graceid>[GEHMT]\d+)/files/$', views.file_list,
name="file_list"),
url(r'^(?P<graceid>[GEHMT]\d+)/files/(?P<filename>.*)$', download,
name="file"),
url(r'^(?P<graceid>[GEHMT]\d+)/log/(?P<num>([\d]*|preview))$',
views.logentry, name="logentry"),
url(r'^(?P<graceid>[GEHMT]\d+)/embblog/(?P<num>([\d]*|preview))$',
views.embblogentry, name="embblogentry"),
url(r'^(?P<graceid>[GEHMT]\d+)/emobservation/(?P<num>([\d]*|preview))$',
views.emobservation_entry, name="emobservation_entry"),
url(r'^(?P<graceid>[GEHMT]\d+)/log/(?P<num>\d+)/tag/(?P<tagname>.*)$',
views.taglogentry, name="taglogentry"),
# RDW Aug 2014
#(r'^admin/', include(admin.site.urls)),
......@@ -34,7 +44,7 @@ urlpatterns = patterns('gracedb.views',
# (r'^edit/(?P<uid>[\w\d]+)', 'edit'),
# (r'^request_archive/(?P<uid>[\w\d]+)(?P<rescind>/rescind)?', 'request_archive'),
# (r'^approve_archive/(?P<uid>[\w\d]+)(?P<rescind>/rescind)?', 'approve_archive'),
# url (r'^query', 'query', name="search"),
# url (r'^mine/$', 'mine', name="mine"),
# url (r'^myapprovals/$', 'myapprovals', name="myapprovals"),
)
# url(r'^query', 'query', name="search"),
# url(r'^mine/$', 'mine', name="mine"),
# url(r'^myapprovals/$', 'myapprovals', name="myapprovals"),
]
# Changed for Django 1.6
from django.conf.urls import patterns, url
#from django.conf.urls.defaults import patterns, url
# Changed for Django 1.11
from django.conf.urls import url
# rest_framework
from gracedb.api import GracedbRoot
......@@ -22,99 +21,97 @@ from gracedb.api import GroupEventPermissionList
from gracedb.api import GroupEventPermissionDetail
from gracedb.api import VOEventList, VOEventDetail
from gracedb.api import OperatorSignoffList
from gracedb.api import download as download_view
urlpatterns = patterns('gracedb.api',
url (r'^/?$', GracedbRoot.as_view(), name="api-root"),
urlpatterns = [
url(r'^$', GracedbRoot.as_view(), name="api-root"),
# Event Resources
# events/[{graceid}[/{version}]]
url (r'events/$',
url(r'events/$',
EventList.as_view(), name='event-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)$',
EventDetail.as_view(), name='event-detail'),
# Event Log Resources
# events/{graceid}/logs/[{logid}]
url (r'events/(?P<graceid>[GEHMT]\d+)/log/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/log/$',
EventLogList.as_view(), name='eventlog-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/log/(?P<n>\d+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/log/(?P<n>\d+)$',
EventLogDetail.as_view(), name='eventlog-detail'),
# VOEvent Resources
# events/{graceid}/voevent/[{serial_number}]
url (r'events/(?P<graceid>[GEHMT]\d+)/voevent/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/voevent/$',
VOEventList.as_view(), name='voevent-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/voevent/(?P<n>\d+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/voevent/(?P<n>\d+)$',
VOEventDetail.as_view(), name='voevent-detail'),
# EMBB Resources
# events/{graceid}/logs/[{logid}]
url (r'events/(?P<graceid>[GEHMT]\d+)/embb/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/embb/$',
EMBBEventLogList.as_view(), name='embbeventlog-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/embb/(?P<n>\d+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/embb/(?P<n>\d+)$',
EMBBEventLogDetail.as_view(), name='embbeventlog-detail'),
url (r'events/(?P<graceid>[GEHMT]\d+)/emobservation/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/emobservation/$',
EMObservationList.as_view(), name='emobservation-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/emobservation/(?P<n>\d+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/emobservation/(?P<n>\d+)$',
EMObservationDetail.as_view(), name='emobservation-detail'),
# url (r'events/(?P<graceid>[GEHMT]\d+)/emobservation/(?P<n>\d+)/emfootprint/$',
# url(r'events/(?P<graceid>[GEHMT]\d+)/emobservation/(?P<n>\d+)/emfootprint/$',
# EMFootprintList.as_view(), name='emfootprint-list'),
# url (r'events/(?P<graceid>[GEHMT]\d+)/emobservation/(?P<n>\d+)/emfootprint/(?P<m>\d+)$',
# url(r'events/(?P<graceid>[GEHMT]\d+)/emobservation/(?P<n>\d+)/emfootprint/(?P<m>\d+)$',
# EMFootprintDetail.as_view(), name='emfootprint-detail'),
# Tag Resources
url (r'^tag/$',
TagList.as_view(), name='tag-list'),
url(r'^tag/$', TagList.as_view(), name='tag-list'),
# XXX unclear what the tag detail resource should be.
#url (r'^tag/(?P<tagname>.+)$',
#url(r'^tag/(?P<tagname>.+)$',
# TagDetail.as_view(), name='tag-detail'),
url (r'events/(?P<graceid>[GEHMT]\d+)/tag/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/tag/$',
EventTagList.as_view(), name='eventtag-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/tag/(?P<tagname>.+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/tag/(?P<tagname>.+)$',
EventTagDetail.as_view(), name='eventtag-detail'),
url (r'events/(?P<graceid>[GEHMT]\d+)/log/(?P<n>\d+)/tag/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/log/(?P<n>\d+)/tag/$',
EventLogTagList.as_view(), name='eventlogtag-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/log/(?P<n>\d+)/tag/(?P<tagname>.+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/log/(?P<n>\d+)/tag/(?P<tagname>.+)$',
EventLogTagDetail.as_view(), name='eventlogtag-detail'),
# Permission Resources
url (r'events/(?P<graceid>[GEHMT]\d+)/perms/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/perms/$',
EventPermissionList.as_view(), name='eventpermission-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/perms/(?P<group_name>.+)/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/perms/(?P<group_name>.+)/$',
GroupEventPermissionList.as_view(), name='groupeventpermission-list'),
url (r'events/(?P<graceid>[GEHMT]\d+)/perms/(?P<group_name>.+)/(?P<perm_shortname>\w+)$',
url(r'events/(?P<graceid>[GEHMT]\d+)/perms/(?P<group_name>.+)/(?P<perm_shortname>\w+)$',
GroupEventPermissionDetail.as_view(), name='groupeventpermission-detail'),
# Event File Resources
# events/{graceid}/files/[{filename}[/{version}]]
url (r'^events/(?P<graceid>\w[\d]+)/files/(?P<filename>.+)?$',
url(r'^events/(?P<graceid>\w[\d]+)/files/(?P<filename>.+)?$',
Files.as_view(), name="files"),
# events/{graceid}/filemeta/[{filename}]
url (r'^events/(?P<graceid>\w[\d]+)/filemeta/(?P<filename>.+)?$',
url(r'^events/(?P<graceid>\w[\d]+)/filemeta/(?P<filename>.+)?$',
FileMeta.as_view(), name="filemeta"),
# Event Labels
# events/{graceid}/labels/[{label}]
url (r'^events/(?P<graceid>\w[\d]+)/labels/(?P<label>.+)?$',
url(r'^events/(?P<graceid>\w[\d]+)/labels/(?P<label>.+)?$',
EventLabel.as_view(), name="labels"),
# Event Neighbors
# events/{graceid}/neighbors/[?delta=(N|(N,N))]
url (r'^events/(?P<graceid>\w[\d]+)/neighbors/$',
url(r'^events/(?P<graceid>\w[\d]+)/neighbors/$',
EventNeighbors.as_view(), name="neighbors"),
# Operator Signoff Resources
url (r'events/(?P<graceid>[GEHMT]\d+)/signoff/$',
url(r'events/(?P<graceid>[GEHMT]\d+)/signoff/$',
OperatorSignoffList.as_view(), name='signoff-list'),
# Performance stats
url (r'^performance/$',
url(r'^performance/$',
PerformanceInfo.as_view(), name='performance-info'),
# Legacy
#url (r'^events/(?P<graceid>\w[\d]+)/files/(?P<filename>.+)?$', 'download', name="files"),
url (r'^event/(?P<graceid>\w[\d]+)/files/(?P<filename>.+)?$', 'download', name="download2"),
)
#url(r'^events/(?P<graceid>\w[\d]+)/files/(?P<filename>.+)?$', 'download', name="files"),
url(r'^event/(?P<graceid>\w[\d]+)/files/(?P<filename>.+)?$', download_view, name="download2"),
]
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.urls import reverse
from models import Event, Group, EventLog, Labelling, Label
from models import Pipeline, Search
from models import CoincInspiralEvent
......
from django.http import HttpResponse, HttpResponseBadRequest
from django.core.urlresolvers import reverse as django_reverse
from django.urls import reverse as django_reverse
from django.utils import dateformat
from django.utils.html import escape, urlize
#from django.utils.http import urlquote
......@@ -48,12 +48,12 @@ def timeToUTC(dt):
#---------------------------------------------------------------------------------------
from rest_framework.reverse import reverse as rest_framework_reverse
from django.core.urlresolvers import resolve, get_script_prefix
from django.urls import resolve, get_script_prefix
# Note about reverse() in this file -- there are THREE versions of it here.
#
# SOURCE LOCAL NAME
# django.core.urlresolvers.reverse ==> django_reverse
# django.urls.reverse ==> django_reverse
# rest_framework.reverse.reverse ==> rest_framework_reverse
# reverse defined below ==> reverse
#
......@@ -70,11 +70,11 @@ def reverse(name, *args, **kw):
Allow for a set of URLs to have been include()-ed on multiple URL paths.
eg urlpatterns = (
(r'^api1/', include('someapp.urls', app_name="api", namespace="x509")),
(r'^api2/', include('someapp.urls', app_name="api", namespace="shib")),
...)
eg urlpatterns = [
(r'^api1/', include('someapp.urls', app_name="api", namespace="x509")),
(r'^api2/', include('someapp.urls', app_name="api", namespace="shib")),
...
]
then reverse("api:root", request=self.request) will give the obviously
correct full URL for the URL named "root" in someapp/urls.py. Django's
reverse will pick one URL path and use it no matter what path the
......
......@@ -3,8 +3,8 @@ from django.http import HttpResponse
from django.http import HttpResponseRedirect, HttpResponseNotFound, HttpResponseBadRequest, Http404
from django.http import HttpResponseForbidden, HttpResponseServerError
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.urls import reverse
from django.shortcuts import render
from models import Event, Group, EventLog, Label, Tag, Pipeline, Search, GrbEvent
from models import EMGroup, Signoff
......@@ -78,7 +78,7 @@ def event_and_auth_required(view):
return inner
def index(request):
# assert request.user
#assert request.user
context = {}
signoff_authorized = False
......@@ -122,21 +122,20 @@ def index(request):
pass
context['recent_events'] = recent_events
return render_to_response('gracedb/index.html', context,
context_instance=RequestContext(request))
return render(request, 'gracedb/index.html', context=context)
def navbar_only(request):
return render_to_response('navbar_only.html', {}, context_instance=RequestContext(request))
return render(request, 'navbar_only.html')
# SP Info and Privacy pages are required for Federation with InCommon.
def spinfo(request):
return render_to_response('gracedb/spinfo.html', {}, context_instance=RequestContext(request))
return render(request, 'gracedb/spinfo.html')
def spprivacy(request):
return render_to_response('gracedb/spprivacy.html', {}, context_instance=RequestContext(request))
return render(request, 'gracedb/spprivacy.html')
def discovery(request):
return render_to_response('discovery.html', {}, context_instance=RequestContext(request))
return render(request, 'discovery.html')
@event_and_auth_required
def voevent(request, event):
......@@ -162,8 +161,7 @@ def create(request):
if isinstance(d, HttpResponse):
return d
else:
return render_to_response('gracedb/create.html', d,
context_instance=RequestContext(request))
return render(request, 'gracedb/create.html', context=d)
def _create(request):
assert request.user
......@@ -340,10 +338,7 @@ def neighbors(request, event, delta1, delta2=None):
context['nearby'] = [(e.gpstime - event.gpstime, e) for e in neighbor_qs]
context['neighbor_delta'] = "[%+d,%+d]" % (delta1, delta2)