Commit 3ccd2e5d authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

main view

parent 05d8bad6
......@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'bootstrap3',
'rainboard',
]
......@@ -120,4 +121,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
SITE_ID = 1
"""dashboard URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'', include('rainboard.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
{% load static bootstrap3 %}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gepetto Packages</title>
<link rel="stylesheet" href="{% bootstrap_css_url %}" crossorigin="anonymous" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" >
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>body { padding-top: 70px; }</style>
{% block style %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Gepetto Packages</a>
</div>
</div>
</nav>
<div class="container">
{% bootstrap_messages %}
{% block content %}
<h1>Hello, world!</h1>
{% endblock %}
</div>
<hr>
<script src="{% bootstrap_jquery_url %}"></script>
<script src="{% bootstrap_javascript_url %}" crossorigin="anonymous" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" ></script>
<script>{% block scripts %}{% endblock %}</script>
</body>
</html>
<tr>
<td>{{ forge.name }}</td>
<td>{{ forge.get_source_display }}</td>
<td>{{ forge.url }}</td>
</tr>
{% extends 'base.html' %}
{% block content %}
<h1>Gepetto RainBoard</h1>
<div class="container-fluid">
<div class="row">
<div class="col-md-5">
<h2>Namespaces</h2>
<table class="table table-striped">
<tr>
<th>Name</th>
</tr>
{% for namespace in namespaces %}
{% include 'rainboard/namespace.html' with namespace=namespace %}
{% endfor %}
</table>
</div>
<div class="col-md-7">
<h2>Forges</h2>
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Type</th>
<th>URL</th>
</tr>
{% for forge in forges %}
{% include 'rainboard/forge.html' with forge=forge %}
{% endfor %}
</table>
</div>
</div>
</div>
<h2>Projects</h2>
<table class="table table-striped">
<tr>
<th>Namespace</th>
<th>Name</th>
<th>License</th>
<th>Homepage</th>
</tr>
{% for project in projects %}
{% include 'rainboard/project.html' with project=project %}
{% endfor %}
</table>
{% endblock %}
<tr>
<td>{{ namespace.name }}</td>
</tr>
<tr>
<td>{{ project.main_namespace }}</td>
<td>{{ project.name }}</td>
<td>{{ project.license }}</td>
<td>{{ project.homepage }}</td>
</tr>
from django.urls import path
from django.views.generic import ListView
from .models import Forge, Namespace, Project
from . import views
app_name = 'cine'
urlpatterns = [
path(r'', views.home, name='home'),
path(r'forges', ListView.as_view(model=Forge), name='forges'),
path(r'namespaces', ListView.as_view(model=Namespace), name='namespaces'),
path(r'projects', ListView.as_view(model=Project), name='projects'),
]
from django.shortcuts import render
# Create your views here.
from .models import Forge, Namespace, Project
def home(request):
return render(request, 'rainboard/home.html', {
'forges': Forge.objects.all(),
'namespaces': Namespace.objects.all(),
'projects': Project.objects.all(),
})
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