Commit 45a8c1c4 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Update of the JobCreation view

I renamed a variable to get something more meaningful than "queryset".

I added a method to pass on to the template data related to the webapp.
parent d4c64130
......@@ -551,10 +551,18 @@ class JobCreate(SuccessMessageMixin, LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs):
"""Pass on the docker name to the template"""
queryset = Webapp.objects.get(docker_name=self.kwargs['docker_name'])
kwargs['webapp_name'] = queryset.name
webapp = Webapp.objects.get(docker_name=self.kwargs['docker_name'])
kwargs['webapp_name'] = webapp.name
return super(JobCreate, self).get_context_data(**kwargs)
def get_form_kwargs(self):
"""Return webapp data"""
kwargs = super(JobCreate, self).get_form_kwargs()
queryset = Webapp.objects.get(docker_name=self.kwargs['docker_name'])
kwargs['webapp'] = queryset
return kwargs
class JobDelete(SuccessMessageMixin, LoginRequiredMixin, DeleteView):
"""Delete a job from the database
......
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 to comment