misc: protect qualification panel against missing source
This commit is contained in:
parent
ba3baa6265
commit
ae975de117
|
@ -1,5 +1,6 @@
|
|||
{% load i18n %}
|
||||
<div>
|
||||
{% if source_pk %}
|
||||
<form>
|
||||
{% if associations|length %}
|
||||
<ul>
|
||||
|
@ -33,6 +34,7 @@
|
|||
<button class="done" data-action-url="{% url 'qualif-done' %}">{% trans 'Submit' %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
|
|
@ -72,9 +72,10 @@ class Qualification(TemplateView):
|
|||
context['form'] = QualificationForm()
|
||||
context['source_type'] = self.request.GET['source_type']
|
||||
context['source_pk'] = self.request.GET['source_pk']
|
||||
context['associations'] = Association.objects.filter(
|
||||
source_type=ContentType.objects.get(id=self.request.GET['source_type']),
|
||||
source_pk=self.request.GET['source_pk'])
|
||||
if self.request.GET.get('source_pk'):
|
||||
context['associations'] = Association.objects.filter(
|
||||
source_type=ContentType.objects.get(id=self.request.GET['source_type']),
|
||||
source_pk=self.request.GET['source_pk'])
|
||||
return context
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue