huge push forward

- cleaned html templates
- added css
- added pageapp
- added imageapp stub
This commit is contained in:
Otto Naderer 2016-08-16 15:13:42 +02:00
parent 92d1cef8c7
commit c7535feb31
22 changed files with 226 additions and 177 deletions

View File

@ -2,58 +2,51 @@
{% block content %} {% block content %}
{% autoescape off %} {% autoescape off %}
<table style="align: center; width: 90%; margin-left: auto; margin-right: auto">
<tbody>
<tr>
<td>
<h1>{{blogentry.header}}</h1>
<small>posted by {{blogentry.user.username}} on {{blogentry.date}}
</small>
<br><br>
{{blogentry.intro|linebreaks}}<br>
{{blogentry.body|linebreaks}}<br><br>
{% endautoescape %}
{% if not isfrontpage %}
<b>Comments total: {{newsentry.newscomment_set.all.count}}</b><br/>
{% for newscomment in newsentry.newscomment_set.all %}
<table class="forumentry">
<tr>
<td align="center" style="border-top:1px; width: 80px; solid #b2c9d5;"><img src="/polylux/{{ newscomment.user.get_profile.getImage }}"></img></td>
<td style="border-top:1px solid #b2c9d5;"><br/><a href="/blackmesa/usermanager/detail/{{newscomment.user.id}}/">{{newscomment.user.username}}</a><br>{{ newscomment.commenttext|linebreaks|urlize }}<br/><small>Datum: {{newscomment.date}}</small></td>
</tr>
</table>
{% endfor %}
<table <h1>{{blogentry.header}}</h1>
style="text-align: left; width: 75%; margin-left: auto; margin-right: auto;" <small>posted by {{blogentry.user.username}} on {{blogentry.date}}
border="0" cellpadding="0" cellspacing="0"> </small>
<tbody> <br><br>
{% if commentform %} {{blogentry.intro|linebreaks}}<br>
<tr> {{blogentry.body|linebreaks}}<br><br>
<td align="center">{{user.username}}<br><img src="/polylux/{{ user.get_profile.getImage }}"></img></td> {% endautoescape %}
<td> {% if false %}
<form action="" method="post"> <b>Comments total: {{newsentry.newscomment_set.all.count}}</b><br/>
{% csrf_token %} {% for newscomment in newsentry.newscomment_set.all %}
{{ commentform.newscomment }}<br> <table class="forumentry">
<input type="submit" value="Submit" /> <tr>
</form> <td align="center" style="border-top:1px; width: 80px; solid #b2c9d5;"><img src="/polylux/{{ newscomment.user.get_profile.getImage }}"></img></td>
</td> <td style="border-top:1px solid #b2c9d5;"><br/><a href="/blackmesa/usermanager/detail/{{newscomment.user.id}}/">{{newscomment.user.username}}</a><br>{{ newscomment.commenttext|linebreaks|urlize }}<br/><small>Datum: {{newscomment.date}}</small></td>
</tr> </tr>
{% else %}
<tr>
<td align="center"></td>
<td>
<strong>Please log in to post.</strong>
</td>
</tr>
{% endif %}
</tbody>
</table>
{% endif %}
</tr>
</td>
</tbody>
</table> </table>
{% endfor %}
<table
style="text-align: left; width: 75%; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
{% if commentform %}
<tr>
<td align="center">{{user.username}}<br><img src="/polylux/{{ user.get_profile.getImage }}"></img></td>
<td>
<form action="" method="post">
{% csrf_token %}
{{ commentform.newscomment }}<br>
<input type="submit" value="Submit" />
</form>
</td>
</tr>
{% else %}
<tr>
<td align="center"></td>
<td>
<strong>Please log in to post.</strong>
</td>
</tr>
{% endif %}
</tbody>
</table>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -8,15 +8,13 @@
{% if blogentries %} {% if blogentries %}
{% for blogentry in blogentries %} {% for blogentry in blogentries %}
<table style="width: 80%"><tr><td ><br/> <h1>{{ blogentry.header }}</h1>
<big><big><big><a href="{% url 'detail' blogentry.id %}">{{ blogentry.header }}</a></big></big></big><br/> <small>posted on: {{blogentry.date}} by {{blogentry.user.username}}</small>
<span style="color: #b0b0b0;"><small>posted on: {{blogentry.date}} by {{blogentry.user.username}}</small></span> <p>{{blogentry.intro|linebreaks}}</p><a href="{% url 'detail' blogentry.id %}">Read more...</a><br/>
<p>{{blogentry.intro|linebreaks}}</p><a href="{% url 'detail' blogentry.id %}">Read more...</a><br/>
<br/><br/></td></tr></table>
{% endfor %} {% endfor %}
{% else %} {% else %}
<p>No entries are available.</p> <p>No entries are available.</p>
{% endif %} {% endif %}
{% endautoescape %} {% endautoescape %}
{% endblock %} {% endblock %}

0
imageapp/__init__.py Normal file
View File

3
imageapp/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
imageapp/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ImageappConfig(AppConfig):
name = 'imageapp'

View File

3
imageapp/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
imageapp/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
imageapp/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

0
pageapp/__init__.py Normal file
View File

18
pageapp/admin.py Normal file
View File

@ -0,0 +1,18 @@
from django import forms
from django.forms import ModelForm, Textarea
from pageapp.models import page
from django.contrib import admin
class pageAdminForm(forms.ModelForm):
class Meta:
model = page
fields = '__all__'
widgets = {
'body': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
}
class pageAdmin(admin.ModelAdmin):
form = pageAdminForm
list_display = ('header', )
admin.site.register(page, pageAdmin)

5
pageapp/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class PageappConfig(AppConfig):
name = 'pageapp'

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-16 11:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='page',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20)),
('header', models.CharField(max_length=50)),
('body', models.CharField(max_length=10000)),
],
),
]

View File

10
pageapp/models.py Normal file
View File

@ -0,0 +1,10 @@
from django.db import models
# Create your models here.
class page(models.Model):
name = models.CharField(max_length = 20)
header = models.CharField(max_length = 50)
body = models.CharField(max_length = 10000)

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content %}
{% autoescape off %}
<h1>{{page.header}}</h1>
{{page.body|linebreaks}}
{% endautoescape %}
{% endblock %}

3
pageapp/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

17
pageapp/views.py Normal file
View File

@ -0,0 +1,17 @@
from pageapp.models import page
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
def getpage(request, page_id):
pagedetail = get_object_or_404(page, pk=page_id)
return render_to_response('pageapp/page.html', {'page': pagedetail}, context_instance=RequestContext(request))
def aboutpage(request):
about = get_object_or_404(page, pk=1)
return render_to_response('pageapp/page.html', {'page': about}, context_instance=RequestContext(request))
def contactpage(request):
contact = get_object_or_404(page, pk=2)
return render_to_response('pageapp/page.html', {'page': contact}, context_instance=RequestContext(request))

View File

@ -32,6 +32,7 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [ INSTALLED_APPS = [
'blogapp.apps.BlogappConfig', 'blogapp.apps.BlogappConfig',
'pageapp.apps.PageappConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',

View File

@ -15,8 +15,13 @@ Including another URLconf
""" """
from django.conf.urls import url, include from django.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
from pageapp.views import aboutpage, contactpage
from blogapp.views import listall
urlpatterns = [ urlpatterns = [
url(r'^blog/', include('blogapp.urls')), url(r'^blog/', include('blogapp.urls')),
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^about/', aboutpage, name='about'),
url(r'^contact/', contactpage, name='contact'),
url(r'^', listall),
] ]

53
static/general.css Normal file
View File

@ -0,0 +1,53 @@
body {
color: #555;
line-height: 1.5;
padding: 4em 1em;
margin-left: auto;
margin-right: auto;
max-width: 50em;
font-family: "Helvetica", "Arial", sans-serif;
}
h1,
h2,
strong {
margin-top: 1em;
padding-top: 1em;
color: #333;
}
a {
color: #ff0066;
text-decoration: none;
}
div#nav{
height:1.5em;
clear:both;
padding-top:.5em;
font-size:1.5em;
}
div#nav ul{
margin:0;
padding:0;
list-style:none;
}
div#nav li{
width: 10.5em;
margin-left: auto;
margin-right: auto;
display:inline-block;
text-align:center;
}
div#main{
padding-top: 1em;
}
img#intext{
padding-top:1em;
padding-bottom:1em;
display: block;
margin-left: auto;
margin-right: auto;
}

View File

@ -2,136 +2,30 @@
<html> <html>
<head> <head>
{% load staticfiles %} {% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static "base-dark.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "general.css" %}" />
{% block head %}{% endblock %} {% block head %}{% endblock %}
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
<title>polylux</title> <title>polylux</title>
</head> </head>
<body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" alink="#000099" link="#000099" vlink="#990099"> <body alink="#000099" link="#000099" vlink="#990099">
<div style="margin: 0 auto; max-width: 1000px !important; padding-right: 20px !important; padding-left: 20px !important;padding-right: 20px !important;"> <div>
<img src="{% static "poly.png" %}"/> <a href="/"><img src="{% static "poly.png" %}"/></a>
</div> </div>
<div style="margin: 0 auto; max-width: 1000px !important; padding-right: 20px !important; padding-left: 20px !important;padding-right: 20px !important;"> <div id="nav">
<ul style="list-style: none"><li style="display: table-cell;">Home</li><li>Blog</li></ul> <ul>
<li><a href="{% url 'listall' %}">Blog</a></li>
<li><a href="{% url 'about' %}">About</a></li>
<li><a href="{% url 'contact' %}">Contact</a></li>
</ul>
</div> </div>
<table style="text-align: left; width: 1000px; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"> <div id="main">
{% block content %}
<tbody> {% endblock %}
<tr> </div>
<td style="vertical-align: top;">
<table style="text-align: left; table-layout: fixed; background-color: rgb(128, 128, 128); width: 100%;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center;">Home<br>
</td>
<td style="vertical-align: top; text-align: center;"><a href="{% url 'listall' %}">Blog</a><br>
</td>
{% for page in pages %}
<td style="vertical-align: top; text-align: center;">Static Page<br>
</td>
{% endfor %}
<td style="vertical-align: top; text-align: center;">Forum<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: middle; background-color: rgb(157, 158, 88);">{% block headline %} {% endblock %}<br>
</td>
<td style="vertical-align: middle; text-align: right; background-color: rgb(157, 158, 88); width: 25%;"><small>
User stuff
</small>
</td>
</tr>
<div id="main">
<tr style="min-height: 1000px;">
<td style="vertical-align: top; background-color: rgb(75, 74, 70); color: rgb(222, 222, 212);">
{% if errormsg %}
<table
style="text-align: left; width: 75%; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(181, 0, 0);">Error:<br>
<ul>
<li>{{ errormsg }}<br>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
{% endif %}
{% block content %} {% endblock %}<br>
</td>
<td style="vertical-align: top; background-color: rgb(60, 60, 60); color: rgb(222, 222, 212);"><br>
{% block sidebar %}
{% if eventlist %}
<b>Aktivitäten:</b>
<table>
{% for evententry in eventlist %}
<tr><td style="">
<small>{% ifchanged evententry.date.date %}<br/>{{evententry.date|date:"d. M."}}:<br/>{% endifchanged %}<b>{{evententry.user.username}}</b> <a href="{{ evententry.eventlink }}">{{ evententry.eventmessage }}</a></small>
</td></tr>
{% endfor %}
</table>
<br/><br/>
{% endif %}
{% if appointmentlist %}
<b>Termine:</b>
<table>
{% for obj in appointmentlist %}
<tr><td style="">
<small><b><a href="/blackmesa/events/{{obj.id}}/">{{obj.eventname}}</a></b><br/>
{% ifequal obj.eventstart.date obj.eventend.date%}
{{obj.eventstart|date:"d. M. H"}}Uhr
{% else %}
{{obj.eventstart|date:"d. M."}}-{{obj.eventend|date:"d. M."}}
{% endifequal %}
({{ obj.getUsersAttending.count }} Gäste)
</small>
</td></tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}
</td>
</tr>
</div>
<tr>
<td style="vertical-align: top; background-color: rgb(128, 128, 128); color: rgb(222, 222, 212);">
<small>
ofl Webpage<br/>
(c) <a href="mailto:polylux@mad.scientist.com">polylux</a><br/>
Site realized utilizing <a href="http://www.djangoproject.com">Django</a>, a great and powerful python-based web development framework.<br/>
Thanks to davidst for hosting this site.
</small>
</td>
<td style="vertical-align: top; background-color: rgb(128, 128, 128); color: rgb(222, 222, 212);">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html> </body></html>