Commit ebc63c6d authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Add of a detail views on apps

I added a detailed view for each app. I updated the urls accordingly in
the webapp list view.
I added as well a name space for the poc app and updated the main menu
template accordingly.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <>
parent 4322aabe
......@@ -2,9 +2,15 @@ from django.conf.urls import url, include
# from django.contrib.auth import views as auth_views
from . import views
app_name = 'main'
urlpatterns = [
url(r'^$', views.index, name="poc_home"),
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'),
# Registration
......@@ -2,7 +2,7 @@ from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render
from django.urls import reverse_lazy
from django.views.generic import CreateView, ListView
from django.views.generic import CreateView, ListView, DetailView
from .models import Webapp, Job
......@@ -11,18 +11,31 @@ def index(request):
return render(request, "home.html")
def list_webapps(request):
webapps = Webapp.objects.all()
return render(request, "webapps.html", locals())
class WebappList(ListView):
Display the paginated list of available webapps.
class WebappList(ListView):
An instance of :model:`poc.Webapp`
model = Webapp
pattern_name = 'webapp_list'
paginate_by = 10
template_name = 'webapp_list.html'
class WebappDetail(DetailView):
model = Webapp
template_name = 'webapp_detail.html'
context_object_name = 'webapp'
class JobList(LoginRequiredMixin, ListView):
model = Job
pattern_name = 'job_list'
<header class="container-fluid">
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="{% url 'poc_home' %}">A||GO</a>
<a class="navbar-brand" href="{% url 'main:home' %}">A||GO</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="{% url 'webapp_list' %}"><i class="fas fa-cloud"></i> apps</a>
<a class="nav-link" href="{% url 'main:webapp_list' %}"><i class="fas fa-cloud"></i> apps</a>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fas fa-book"></i> Docs</a>
......@@ -22,10 +22,10 @@
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'job_list' %}"><i class="fas fa-database"></i> My jobs</a>
<a class="nav-link" href="{% url 'main:job_list' %}"><i class="fas fa-database"></i> My jobs</a>
<li class="nav-item">
<a class="nav-link" href="{% url 'logout' %}"><i class="fas fa-sign-out-alt"></i> Sign out</a>
<a class="nav-link" href="{% url 'main:logout' %}"><i class="fas fa-sign-out-alt"></i> Sign out</a>
{% endif %}
{% extends "base.html" %}
{% block title %}{{ }}{% endblock %}
{% block content %}
<h2>{{ }}</h2>
<p>{{ webapp.description }}</p>
{% endblock %}
......@@ -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">{{ webapp.title }}</h5>
<h5 class="card-title"><a href="{% url 'main:webapp_detail' %}">{{ }}</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