fill datenbank app
This commit is contained in:
@@ -15,3 +15,5 @@ my.cnf
|
|||||||
venv
|
venv
|
||||||
|
|
||||||
*/*/*/migrations/*
|
*/*/*/migrations/*
|
||||||
|
|
||||||
|
web_dev/media/*
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
#datenbank_html {
|
|
||||||
margin-left: 2%;
|
|
||||||
width: 96%;
|
|
||||||
}
|
|
||||||
tabledatabase {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
}
|
|
||||||
.trdatabase {
|
|
||||||
padding-top: 50px;
|
|
||||||
padding-bottom: 50px;
|
|
||||||
}
|
|
||||||
.tddatabase {
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
thumbnail {
|
|
||||||
display: inline-block;
|
|
||||||
border: 1px solid black;
|
|
||||||
width: 20%;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
max-width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.polaroid {
|
|
||||||
border: 2px solid #e7e7e7;
|
|
||||||
width: 80%;
|
|
||||||
background-color: white;
|
|
||||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
||||||
margin-bottom: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.container {
|
|
||||||
text-align: center;
|
|
||||||
padding: 10px 20px;
|
|
||||||
font-family: Helvetica, serif;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
#description {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<div id="datenbank_html">
|
|
||||||
<table class="tabledatabase">
|
|
||||||
<tr class="trdatabase">
|
|
||||||
<td class="tddatabase", colspan=4>
|
|
||||||
<p id="description">
|
|
||||||
Dies ist eine Datenbank mit allen Dokumenten, die die Goethopische Agentur für politische Bildung herausgebracht hat. Jedes der Elemente ist auf das dazugehörige PDF-Dokument verlinkt.
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="trdatabase">
|
|
||||||
<td class="tddatabase", align="left">
|
|
||||||
<div class="polaroid">
|
|
||||||
<a class="thumbnail" href="http://www.none.com">
|
|
||||||
<img src="verfassung.jpg" alt="Verfassung">
|
|
||||||
</a>
|
|
||||||
<div class="container">
|
|
||||||
<p>Die Verfassung von Goethopia</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="tddatabase" align="center">
|
|
||||||
<div class="polaroid">
|
|
||||||
<a class="thumbnail" href="http://www.none.com">
|
|
||||||
<img src="geschaeftsordnung.jpg" alt="Geschaeftsordnung">
|
|
||||||
</a>
|
|
||||||
<div class="container">
|
|
||||||
<p>Die Geschäftsordnung des Parlaments</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="tddatabase" align="right">
|
|
||||||
<div class="polaroid">
|
|
||||||
<a class="thumbnail" href="http://www.none.com">
|
|
||||||
<img src="faq_1.jpg" alt="Informationsblatt 1">
|
|
||||||
</a>
|
|
||||||
<div class="container">
|
|
||||||
<p>Informationsblatt der APB, Ausgabe 1</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import Entry
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
class EntryAdmin(admin.ModelAdmin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
admin.site.register(Entry, EntryAdmin)
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
class Entry(models.Model):
|
||||||
|
title = models.CharField(max_length=100)
|
||||||
|
pub_date = models.DateTimeField('Veröffentlichungsdatum')
|
||||||
|
image = models.ImageField('Vorschaubild', upload_to='thumbnails')
|
||||||
|
element = models.FileField('Datei', upload_to='datastorage')
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#datenbank_html {
|
||||||
|
margin-left: 2%;
|
||||||
|
width: 96%;
|
||||||
|
}
|
||||||
|
.tabledatabase {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.trdatabase {
|
||||||
|
padding-top: 50px;
|
||||||
|
padding-bottom: 50px;
|
||||||
|
}
|
||||||
|
.tddatabase {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
.thumbnail {
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px solid black;
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.polaroid {
|
||||||
|
border: 2px solid #e7e7e7;
|
||||||
|
width: 80%;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.container {
|
||||||
|
text-align: center;
|
||||||
|
padding: 10px 20px;
|
||||||
|
font-family: Helvetica, serif;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
#description {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
@@ -1,5 +1,35 @@
|
|||||||
{% extends "public/default.html" %}
|
{% extends "public/default.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>Datenbank</p>
|
<link rel="stylesheet" type="text/css" href="{% static "datenbank/css/index.css"%}">
|
||||||
|
<div id="datenbank_html">
|
||||||
|
<table class="tabledatabase">
|
||||||
|
<tr class="trdatabase">
|
||||||
|
<td class="tddatabase", colspan=4>
|
||||||
|
<p id="description">
|
||||||
|
Dies ist eine Datenbank mit allen Dokumenten, die die
|
||||||
|
Goethopische Agentur für politische Bildung herausgebracht hat.
|
||||||
|
Jedes der Elemente ist auf das dazugehörige PDF-Dokument verlinkt.
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% for row in rows %}
|
||||||
|
<tr class="trdatabase">
|
||||||
|
{% for entry in row %}
|
||||||
|
<td class="tddatabase", align="{% cycle "left" "center" "right" %}">
|
||||||
|
<div class="polaroid">
|
||||||
|
<a class="thumbnail" href="{{ entry.element.url }}">
|
||||||
|
<img src="{{ entry.image.url }}" alt="Verfassung">
|
||||||
|
</a>
|
||||||
|
<div class="container">
|
||||||
|
<p>{{ entry.title }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
import math
|
||||||
|
|
||||||
|
from .models import Entry
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def index(request):
|
def index(request):
|
||||||
return render(request, "datenbank/index.html")
|
rows = group(Entry.objects.all(), 3)
|
||||||
|
print("rows", rows)
|
||||||
|
return render(request, "datenbank/index.html", {'rows': rows})
|
||||||
|
|
||||||
|
|
||||||
|
def group(l, n):
|
||||||
|
return [l[k*n:k*n+n] for k in range(math.ceil(len(l) / n))]
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
urlpatterns += [
|
||||||
url(r'^$', include('startpage.urls', namespace='startpage', app_name='startpage')),
|
url(r'^$', include('startpage.urls', namespace='startpage', app_name='startpage')),
|
||||||
url(r'^meingoethopia', include('meingoethopia.urls',
|
url(r'^meingoethopia', include('meingoethopia.urls',
|
||||||
namespace='meingoethopia',
|
namespace='meingoethopia',
|
||||||
|
|||||||
Reference in New Issue
Block a user