Commit 071afcdd by Őry Máté

dashboard: show less templates for superusers

parent d47bbafa
...@@ -225,7 +225,7 @@ class IndexView(LoginRequiredMixin, TemplateView): ...@@ -225,7 +225,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
# template # template
if user.has_perm('vm.create_template'): if user.has_perm('vm.create_template'):
context['templates'] = InstanceTemplate.get_objects_with_level( context['templates'] = InstanceTemplate.get_objects_with_level(
'operator', user).all()[:5] 'operator', user, disregard_superuser=True).all()[:5]
# toplist # toplist
if settings.STORE_URL: if settings.STORE_URL:
...@@ -1844,8 +1844,8 @@ class VmCreate(LoginRequiredMixin, TemplateView): ...@@ -1844,8 +1844,8 @@ class VmCreate(LoginRequiredMixin, TemplateView):
form_error = form is not None form_error = form is not None
template = (form.template.pk if form_error template = (form.template.pk if form_error
else request.GET.get("template")) else request.GET.get("template"))
templates = InstanceTemplate.get_objects_with_level('user', templates = InstanceTemplate.get_objects_with_level(
request.user) 'user', request.user, disregard_superuser=True)
if form is None and template: if form is None and template:
form = self.form_class(user=request.user, form = self.form_class(user=request.user,
template=templates.get(pk=template)) template=templates.get(pk=template))
......
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