Commit a5106f3d by Őry Máté

dashboard: make 💩 code more readable

parent ffbd9baa
...@@ -2120,9 +2120,11 @@ class VmCreate(LoginRequiredMixin, TemplateView): ...@@ -2120,9 +2120,11 @@ class VmCreate(LoginRequiredMixin, TemplateView):
if not request.user.has_perm('vm.create_vm'): if not request.user.has_perm('vm.create_vm'):
raise PermissionDenied() raise PermissionDenied()
form_error = form is not None if form is None:
template_pk = (form.template.pk if form_error template_pk = request.GET.get("template")
else request.GET.get("template")) else:
template_pk = form.template.pk
if template_pk: if template_pk:
template = get_object_or_404(InstanceTemplate, pk=template_pk) template = get_object_or_404(InstanceTemplate, pk=template_pk)
if not template.has_level(request.user, 'user'): if not template.has_level(request.user, 'user'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment