Commit 4413e026 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Update of the webapp detail view

I updated the webapp detail view in order to display the information
according the its docker name. I updated the url naming to fit the
original allgo app.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <>
parent 083dd462
......@@ -6,8 +6,7 @@ app_name = 'main'
urlpatterns = [
url(r'^$', views.index, name="home"),
url(r'^apps/$', views.WebappList.as_view(), name='webapp_list'),
url(r'^jobs/$', views.JobList.as_view(), name='job_list'),
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.views.generic import (
......@@ -31,17 +31,23 @@ class WebappList(ListView):
pattern_name = 'webapp_list'
paginate_by = 10
template_name = 'webapp_list.html'
def get_queryset(self):
queryset = Webapp.objects.all().order_by('-created_at')
return queryset
queryset = Webapp.objects.all().order_by('-created_at')
class WebappDetail(DetailView):
Display the details of an app based on its docker name
model = Webapp
template_name = 'webapp_detail.html'
context_object_name = 'webapp'
def get_object(self):
data = self.kwargs.get('docker_name', None)
queryset = get_object_or_404(Webapp, docker_name=data)
return queryset
class JobList(LoginRequiredMixin, ListView):
model = Job
......@@ -10,7 +10,7 @@
<div class="card">
<img class="card-img-top" src="{{ webapp.logo_file_name }}" alt="{{ webapp.title }} logo">
<div class="card-body">
<h5 class="card-title"><a href="{% url 'main:webapp_detail' %}">{{ }}</a></h5>
<h5 class="card-title"><a href="{% url 'main:webapp_detail' webapp.docker_name %}">{{ }}</a></h5>
<p class="card-text">
{% if webapp.description %}
{{ webapp.description|truncatechars:200 }}
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