Permalink
Browse files

set project context variable in exam/question edit pages

In particular, this makes it so that the new question/exam buttons on
the nav bar create inside the same project as the item you're currently
editing.
This also sets the search url so that searching from an edit page
searches within the current item's project.
  • Loading branch information...
1 parent a0b29a1 commit 6bf12753a4e6622e63e0cd6a34568fdbb99338c1 @christianp christianp committed Nov 21, 2016
Showing with 4 additions and 0 deletions.
  1. +2 −0 editor/templates/editoritem/edit.html
  2. +2 −0 editor/views/editoritem.py
@@ -12,6 +12,8 @@
{% block skipMathJaxStartup %}true{% endblock %}
+{% block search_url %}{% url 'project_search' object.editoritem.project.pk %}{% endblock search_url %}
+
{% block javascripts %}
{{ block.super }}
@@ -192,6 +192,8 @@ def get_context_data(self, **kwargs):
context['can_delete'] = self.can_delete
context['can_copy'] = self.can_copy
+ context['project'] = self.object.editoritem.project
+
context['access_rights'] = [{'user': user_json(a.user), 'access_level': a.access} for a in Access.objects.filter(item=self.object.editoritem)]
licences = [licence.as_json() for licence in Licence.objects.all()]

0 comments on commit 6bf1275

Please sign in to comment.