I'm trying to modify OMERO.web UI a little for our purpose.
I tried to add another link at the bottom (footer) of "base_main.html" like
- Code: Select all
<a href="{% url myapp %}" title="myapp ">{% trans "myapp" %}</a>
And I modified urls.py
- Code: Select all
url( r'^myapp/$', views.myapp, name="myapp" ),
and also views.py
- Code: Select all
@isUserConnected
def myapp( request, **kwargs):
# get connection
conn = None
try:
conn = kwargs["conn"]
except:
logger.error(traceback.format_exc())
return handlerInternalError("Connection is not available. Please contact your administrator.")
session = conn.c.sf;
class PARAM:
eContext = {'breadcrumb': list()}
containers = {'Positive_Dataset':list(), 'Negative_Dataset':list(), 'Test_Dataset':list()}
param = PARAM
param.containers['Positive_Dataset'] = [long(452)]
param.containers['Negative_Dataset'] = [long(451)]
param.containers['Test_Dataset'] = [long(455)]
param.eContext['breadcrumb'] = ['myapp']
menu = request.REQUEST.get("menu")
if menu is not None:
request.session['nav']['menu'] = menu
else:
menu = request.session['nav']['menu']
try:
url = reverse(viewname="load_template", args=[menu])
except:
url = reverse("webindex")
context = {'nav':request.session['nav'], 'url':url, 'eContext':param.eContext, 'param':param}
template = 'webclient/myapp/myapp.html'
t = template_loader.get_template(template)
c = Context(request,context)
return HttpResponse(t.render(c))
And it basically works when I click the link.
But sometimes (like when I was in the "basket" page before) it gives me an error like
Traceback (most recent call last):
File "/.../base.py", line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/.../views.py", line 155, in wrapped
return f(request, *args, **kwargs)
File "/.../views.py", line 2840, in myapp
return HttpResponse(t.render(c))
NoReverseMatch: Reverse for 'load_template' with arguments '('basket',)' and keyword arguments '{}' not found.
Do you have any idea on this?
BK