Merge branch 'news' of https://github.com/Pentabyteman/SaS
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from .models import ParteiWerbung
|
||||||
|
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
|
class ParteiWerbungAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('partei',)
|
||||||
|
|
||||||
|
admin.site.register(ParteiWerbung, ParteiWerbungAdmin)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class NewsConfig(AppConfig):
|
||||||
|
name = 'news'
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
|
class ParteiWerbung(models.Model):
|
||||||
|
partei = models.ForeignKey('meingoethopia.Partei')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return str(self.partei)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Parteiwerbung'
|
||||||
|
verbose_name_plural = 'Parteienwerbung'
|
||||||
|
|
||||||
|
|
||||||
|
class PraesidentWerbung(models.Model):
|
||||||
|
partei = models.ForeignKey('meingoethopia.PresidentCandidate')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return str(self.partei)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Präsidentwerbung'
|
||||||
|
verbose_name_plural = 'Präsidentenwerbung'
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{% extends "public/default.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p></p>
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static "datenbank/css/index.css"%}">
|
||||||
|
<div id="datenbank_html">
|
||||||
|
<table class="tabledatabase">
|
||||||
|
<tr>
|
||||||
|
<th style="width:33%"/>
|
||||||
|
<th style="width:33%"/>
|
||||||
|
<th style="width:33%"/>
|
||||||
|
</tr>
|
||||||
|
<tr class="trdatabase">
|
||||||
|
<td class="tddatabase" colspan="3">
|
||||||
|
<p id="description">
|
||||||
|
Bald wird gewählt in Goethopia! Hier erfährst du welche Parteien zur Wahl stehen
|
||||||
|
und wer als Präsidentin kandidiert!
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% if rows|length == 0 %}
|
||||||
|
<tr>
|
||||||
|
<td class="tddatabase" colspan="3">
|
||||||
|
<p id="description">
|
||||||
|
<b>Keine Parteien gefunden</b>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% 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.partei.name }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
from django.conf.urls import url
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^$', views.index, name='index')
|
||||||
|
]
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
import math
|
||||||
|
|
||||||
|
from .models import ParteiWerbung
|
||||||
|
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
def index(request):
|
||||||
|
objects = ParteiWerbung.objects.all()
|
||||||
|
rows = group(objects, 3)
|
||||||
|
return render(request, "news/index.html", {'rows': rows,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def group(l, n):
|
||||||
|
return [l[k*n:k*n+n] for k in range(math.ceil(len(l) / n))]
|
||||||
@@ -49,6 +49,7 @@ USE_X_FORWARDED_HOST = True
|
|||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
|
'news',
|
||||||
'captcha',
|
'captcha',
|
||||||
'datenbank',
|
'datenbank',
|
||||||
'meingoethopia',
|
'meingoethopia',
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ from .views import error_400, error_403, error_404, error_500
|
|||||||
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
|
url(r'^news/', include('news.urls',
|
||||||
|
namespace='news',
|
||||||
|
app_name='news')),
|
||||||
url(r'^meingoethopia/', include('meingoethopia.urls',
|
url(r'^meingoethopia/', include('meingoethopia.urls',
|
||||||
namespace='meingoethopia',
|
namespace='meingoethopia',
|
||||||
app_name='meingoethopia')),
|
app_name='meingoethopia')),
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ ul.navbar {
|
|||||||
|
|
||||||
li.navbar {
|
li.navbar {
|
||||||
float: left;
|
float: left;
|
||||||
width: 30%;
|
width: 21%;
|
||||||
margin-top: 0.5%;
|
margin-top: 0.5%;
|
||||||
margin-bottom: 0.5%;
|
margin-bottom: 0.5%;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
<ul class="navbar">
|
<ul class="navbar">
|
||||||
<li class ="navbar"><a {% if appname == "startpage" %}class="active"{% endif %} href="/">Information</a></li>
|
<li class ="navbar"><a {% if appname == "startpage" %}class="active"{% endif %} href="/">Information</a></li>
|
||||||
|
<li class ="navbar"><a {% if appname == "news" %}class="active"{% endif %} href="{% url "news:index" %}">Wahl '18</a></li>
|
||||||
<li class="navbar"><a {% if appname == "datenbank" %}class="active"{% endif %} href="{% url "datenbank:index" %}">Datenbank</a></li>
|
<li class="navbar"><a {% if appname == "datenbank" %}class="active"{% endif %} href="{% url "datenbank:index" %}">Datenbank</a></li>
|
||||||
<li class="navbar"><a {% if appname == "meingoethopia" %}class="active"{% endif %} href="{% url "meingoethopia:index" %}">Mein Goethopia</a></li>
|
<li class="navbar"><a {% if appname == "meingoethopia" %}class="active"{% endif %} href="{% url "meingoethopia:index" %}">Mein Goethopia</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user