Events und Gallery in einzelne Apps aufgetielt.
Lokalisierung auf einzelne Apps aufgeteilt Mai-Star Ranking in die Navigation integriert
This commit is contained in:
@@ -5,6 +5,7 @@ Created on 19.09.2011
|
||||
"""
|
||||
# import stuff we need from django
|
||||
from django.contrib import admin
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
@@ -57,6 +58,7 @@ class PageAdmin(admin.ModelAdmin):
|
||||
'/static/js/tinymce_setup.js',
|
||||
]
|
||||
|
||||
|
||||
admin.site.register(models.Article, ArticleAdmin)
|
||||
admin.site.register(models.Page, PageAdmin)
|
||||
admin.site.register(models.Category, CategoryAdmin)
|
||||
|
||||
@@ -4,9 +4,10 @@ Created on 30.09.2011
|
||||
|
||||
@author: christian
|
||||
"""
|
||||
from . import models
|
||||
from django.core.cache import cache
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
def content_menus(request):
|
||||
current_page = None
|
||||
@@ -46,4 +47,4 @@ def content_menus(request):
|
||||
'current_top_page': current_top_page,
|
||||
'current_path': current_path,
|
||||
'current_page': current_page
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
from datetime import datetime, time
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.contrib import comments
|
||||
from django.contrib.syndication.views import Feed
|
||||
from django.utils.feedgenerator import Rss201rev2Feed
|
||||
|
||||
from models import Article
|
||||
|
||||
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
class LatestNews(Feed):
|
||||
link = "http://www.kasu.at/"
|
||||
|
||||
@@ -8,7 +8,6 @@ from django.template.defaultfilters import slugify
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from utils.html5 import forms
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
|
||||
BIN
content/locale/de/LC_MESSAGES/django.mo
Normal file
BIN
content/locale/de/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
251
content/locale/de/LC_MESSAGES/django.po
Normal file
251
content/locale/de/LC_MESSAGES/django.po
Normal file
@@ -0,0 +1,251 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: kasu.content\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-12-09 20:35+0100\n"
|
||||
"PO-Revision-Date: 2014-12-08 16:15+0100\n"
|
||||
"Last-Translator: Christian Berg <xeniac.at@gmail.com>\n"
|
||||
"Language-Team: Kasu <verein@kasu.at>\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Translated-Using: django-rosetta 0.7.2\n"
|
||||
"X-Generator: Poedit 1.6.11\n"
|
||||
|
||||
#: feeds.py:16
|
||||
msgid "Current news from Kasu"
|
||||
msgstr "Aktuelle Nachrichten von Kasu"
|
||||
|
||||
#: feeds.py:44
|
||||
msgid "Latest comments on kasu.at"
|
||||
msgstr "Neueste Kommentare auf Kasu.at "
|
||||
|
||||
#: feeds.py:45
|
||||
msgid "Kasu - latest comments"
|
||||
msgstr "Kasu - neue Kommentare"
|
||||
|
||||
#: forms.py:52 models.py:201
|
||||
msgid "Please upload a PDF-File to this PDF-Page."
|
||||
msgstr "Bitte eine PDF Datei für diese PDF Seite hochladen."
|
||||
|
||||
#: models.py:48
|
||||
msgid "Headline"
|
||||
msgstr "Schlagzeile"
|
||||
|
||||
#: models.py:50
|
||||
msgid "Content"
|
||||
msgstr "Inhalt"
|
||||
|
||||
#: models.py:52 models.py:231 templates/content/article_detail.html:34
|
||||
msgid "Category"
|
||||
msgstr "Kategorie"
|
||||
|
||||
#: models.py:53 models.py:225
|
||||
msgid "Image"
|
||||
msgstr "Bild"
|
||||
|
||||
#: models.py:55 models.py:227
|
||||
msgid "Slug"
|
||||
msgstr "Slug"
|
||||
|
||||
#: models.py:57 templates/content/article_detail.html:32
|
||||
msgid "Author"
|
||||
msgstr "Autor"
|
||||
|
||||
#: models.py:58
|
||||
msgid "Status"
|
||||
msgstr "Status"
|
||||
|
||||
#: models.py:60
|
||||
msgid "Created"
|
||||
msgstr "Erstellt"
|
||||
|
||||
#: models.py:61
|
||||
msgid "Modified"
|
||||
msgstr "Bearbeitet"
|
||||
|
||||
#: models.py:65
|
||||
msgid "Article"
|
||||
msgstr "Artikel"
|
||||
|
||||
#: models.py:66
|
||||
msgid "Articles"
|
||||
msgstr "Artikel"
|
||||
|
||||
#: models.py:123 models.py:129
|
||||
msgid "The short name for the menu-entry of this page"
|
||||
msgstr "Ein kurzer Name für den Menüeintrag"
|
||||
|
||||
#: models.py:133 models.py:136
|
||||
msgid "This title appears in the HTML header"
|
||||
msgstr "Der Titel erscheint im HTML Header"
|
||||
|
||||
#: models.py:137
|
||||
msgid "slug"
|
||||
msgstr "Slug"
|
||||
|
||||
#: models.py:138
|
||||
msgid "Path"
|
||||
msgstr "Pfad"
|
||||
|
||||
#: models.py:144
|
||||
msgid "Position"
|
||||
msgstr "Position"
|
||||
|
||||
#: models.py:146
|
||||
msgid "status"
|
||||
msgstr "Status"
|
||||
|
||||
#: models.py:152
|
||||
msgid "enable comments"
|
||||
msgstr "Kommentare möglich"
|
||||
|
||||
#: models.py:153
|
||||
msgid "Template"
|
||||
msgstr "Vorlage"
|
||||
|
||||
#: models.py:216
|
||||
msgid "Page"
|
||||
msgstr "Seite"
|
||||
|
||||
#: models.py:217
|
||||
msgid "Pages"
|
||||
msgstr "Seiten"
|
||||
|
||||
#: models.py:221 models.py:222
|
||||
msgid "Name"
|
||||
msgstr "Name"
|
||||
|
||||
#: models.py:223 models.py:224
|
||||
msgid "Description"
|
||||
msgstr "Beschreibung"
|
||||
|
||||
#: models.py:232
|
||||
msgid "Categories"
|
||||
msgstr "Kategorien"
|
||||
|
||||
#: views.py:42
|
||||
msgid "This Category does not exist."
|
||||
msgstr "Diese Kategorie existiert nicht."
|
||||
|
||||
#: views.py:152
|
||||
#, python-format
|
||||
msgid "No Page found matching the Path %s"
|
||||
msgstr "Keine Seite unter dem Pfad %s gefunden"
|
||||
|
||||
#: views.py:166
|
||||
#, python-format
|
||||
msgid "No PDF Document found matching the Path %s"
|
||||
msgstr "Kein PDF Dokument unter dem Pfad %s gefunden."
|
||||
|
||||
#: templates/content/article_archive.html:5
|
||||
#: templates/content/article_archive.html:11
|
||||
#: templates/content/article_archive.html:17
|
||||
msgid "Article Archive"
|
||||
msgstr "Nachrichtenarchiv"
|
||||
|
||||
#: templates/content/article_archive.html:32
|
||||
#: templates/content/article_archive_month.html:5
|
||||
#: templates/content/article_archive_year.html:7
|
||||
msgid "Archive"
|
||||
msgstr "Archiv"
|
||||
|
||||
#: templates/content/article_archive.html:49
|
||||
msgid "All Categories"
|
||||
msgstr "Alle Kategorien"
|
||||
|
||||
#: templates/content/article_archive.html:64
|
||||
msgid "created on"
|
||||
msgstr "erstellt am"
|
||||
|
||||
#: templates/content/article_archive.html:65
|
||||
msgid "by"
|
||||
msgstr "von"
|
||||
|
||||
#: templates/content/article_archive.html:66
|
||||
msgid "comments"
|
||||
msgstr "Kommentare"
|
||||
|
||||
#: templates/content/article_archive.html:70
|
||||
msgid "Read More"
|
||||
msgstr "Mehr lesen"
|
||||
|
||||
#: templates/content/article_archive.html:73
|
||||
msgid "We're sorry. Your search yielded no results."
|
||||
msgstr "Es tut uns leid. Deine Suche ergab keine Treffer."
|
||||
|
||||
#: templates/content/article_archive.html:91
|
||||
msgid "Add Article"
|
||||
msgstr "neuer Artikel "
|
||||
|
||||
#: templates/content/article_archive_month.html:7
|
||||
msgid "back"
|
||||
msgstr "Zurück"
|
||||
|
||||
#: templates/content/article_detail.html:33
|
||||
msgid "Created on"
|
||||
msgstr "Erstellt am"
|
||||
|
||||
#: templates/content/article_detail.html:39
|
||||
msgid "Share on Google+"
|
||||
msgstr "Auf Google+ teilen"
|
||||
|
||||
#: templates/content/article_detail.html:40
|
||||
msgid "Share on Twitter"
|
||||
msgstr "Auf Twitter teilen"
|
||||
|
||||
#: templates/content/article_detail.html:41
|
||||
msgid "Share on Facebook"
|
||||
msgstr "Auf Facebook teilen"
|
||||
|
||||
#: templates/content/article_detail.html:52
|
||||
#: templates/content/article_form.html:5
|
||||
#: templates/content/article_form.html:21
|
||||
msgid "Edit Article"
|
||||
msgstr "Artikel bearbeiten"
|
||||
|
||||
#: templates/content/article_form.html:5
|
||||
#: templates/content/article_form.html:21
|
||||
msgid "Create Article"
|
||||
msgstr "Artikel erstellen"
|
||||
|
||||
#: templates/content/article_form.html:26 templates/content/page_form.html:29
|
||||
#: templates/content/page_form.html:35
|
||||
msgid "German"
|
||||
msgstr "Deutsch"
|
||||
|
||||
#: templates/content/article_form.html:27 templates/content/page_form.html:30
|
||||
#: templates/content/page_form.html:39
|
||||
msgid "English"
|
||||
msgstr "Englisch"
|
||||
|
||||
#: templates/content/article_form.html:40 templates/content/page_form.html:50
|
||||
msgid "reset"
|
||||
msgstr "Zurücksetzen"
|
||||
|
||||
#: templates/content/article_form.html:41 templates/content/page_form.html:51
|
||||
msgid "save"
|
||||
msgstr "Speichern"
|
||||
|
||||
#: templates/content/page.html:23
|
||||
msgid "Subpages"
|
||||
msgstr "Unterseiten"
|
||||
|
||||
#: templates/content/page_form.html:4 templates/content/page_form.html:24
|
||||
msgid "Edit Page"
|
||||
msgstr "Seite bearbeiten"
|
||||
|
||||
#: templates/content/page_form.html:4 templates/content/page_form.html:24
|
||||
msgid "Add Page"
|
||||
msgstr "Seite hinzufügen"
|
||||
|
||||
#: templates/content/page_form.html:45
|
||||
msgid "HTML Specific"
|
||||
msgstr "HTML spezifisch"
|
||||
@@ -24,7 +24,8 @@ class Command(BaseCommand):
|
||||
|
||||
def create_article(self):
|
||||
self.slug = slugify(self.headline[:50])
|
||||
article, created = Article.objects.get_or_create(slug=self.slug, date_created=self.date_created,
|
||||
article, created = Article.objects.get_or_create(slug=self.slug,
|
||||
date_created=self.date_created,
|
||||
defaults={
|
||||
'author': self.author,
|
||||
'headline_de': self.headline,
|
||||
@@ -37,9 +38,11 @@ class Command(BaseCommand):
|
||||
article.save()
|
||||
|
||||
def parse_with_date(self, original):
|
||||
match_obj = re.search(self.date_header_regex, original, re.IGNORECASE | re.DOTALL)
|
||||
match_obj = re.search(self.date_header_regex, original,
|
||||
re.IGNORECASE | re.DOTALL)
|
||||
if match_obj:
|
||||
self.date_created = datetime.strptime(match_obj.group('date'), '%d.%m.%Y')
|
||||
self.date_created = datetime.strptime(match_obj.group('date'),
|
||||
'%d.%m.%Y')
|
||||
self.headline = match_obj.group('title').strip()
|
||||
self.content = match_obj.group('content').strip()
|
||||
return True
|
||||
@@ -47,7 +50,8 @@ class Command(BaseCommand):
|
||||
return False
|
||||
|
||||
def parse_without_date(self, original):
|
||||
match_obj = re.search(self.header_regex, original, re.IGNORECASE | re.DOTALL)
|
||||
match_obj = re.search(self.header_regex, original,
|
||||
re.IGNORECASE | re.DOTALL)
|
||||
if match_obj:
|
||||
self.date_created = datetime.strptime('01.01.1982', '%d.%m.%Y')
|
||||
self.headline = match_obj.group('title').strip()
|
||||
@@ -71,7 +75,8 @@ class Command(BaseCommand):
|
||||
if not table.cell_value(row, 2) in ('Archiv', 'News'):
|
||||
continue
|
||||
original = table.cell_value(row, 3)
|
||||
if self.parse_with_date(original) or self.parse_without_date(original):
|
||||
if self.parse_with_date(original) or self.parse_without_date(
|
||||
original):
|
||||
self.create_article()
|
||||
else:
|
||||
print "Fehler bei String!"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.datetime_safe import datetime
|
||||
|
||||
from events.models import Event, Location
|
||||
import xlrd
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@ from django.db import models
|
||||
from django.template.defaultfilters import slugify
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import get_language, ugettext as _
|
||||
from imagekit.models import ImageSpecField
|
||||
from imagekit.processors import SmartResize
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
from kasu.image_models import ImageModel
|
||||
from utils import STATUS_CHOICES, STATUS_WAITING, STATUS_PUBLISHED, \
|
||||
cleaner
|
||||
|
||||
@@ -40,17 +39,6 @@ def get_upload_path(instance, filename):
|
||||
return "categories/%s.%s" % (instance.slug, extension)
|
||||
|
||||
|
||||
class ImageModel(models.Model):
|
||||
article = ImageSpecField(
|
||||
source='image',
|
||||
processors=[SmartResize(width=210, height=130)]
|
||||
|
||||
)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class ArticleManager(models.Manager):
|
||||
def published(self):
|
||||
return self.filter(status=STATUS_PUBLISHED, date_created__lte=now())
|
||||
@@ -65,7 +53,8 @@ class Article(ImageModel):
|
||||
image = models.ImageField(_('Image'), upload_to='news/',
|
||||
blank=True, null=True)
|
||||
slug = models.SlugField(_('Slug'), unique_for_month='date_created')
|
||||
author = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('Author'))
|
||||
author = models.ForeignKey(settings.AUTH_USER_MODEL,
|
||||
verbose_name=_('Author'))
|
||||
status = models.SmallIntegerField(_('Status'), choices=STATUS_CHOICES,
|
||||
default=STATUS_PUBLISHED)
|
||||
date_created = models.DateTimeField(_('Created'), blank=True)
|
||||
@@ -140,15 +129,18 @@ class Page(models.Model):
|
||||
help_text=_('The short name for the menu-entry of this page')
|
||||
)
|
||||
title_de = models.CharField('Titel', max_length=255,
|
||||
help_text=_('This title appears in the HTML header'))
|
||||
help_text=_(
|
||||
'This title appears in the HTML header'))
|
||||
title_en = models.CharField('Title', max_length=255, blank=True,
|
||||
help_text=_('This title appears in the HTML header'))
|
||||
help_text=_(
|
||||
'This title appears in the HTML header'))
|
||||
slug = models.SlugField(_('slug'))
|
||||
path = models.CharField(_('Path'), max_length=100, db_index=True,
|
||||
editable=False, unique=True)
|
||||
|
||||
parent = models.ForeignKey('self', blank=True, null=True,
|
||||
related_name='subpages', on_delete=models.SET_NULL)
|
||||
related_name='subpages',
|
||||
on_delete=models.SET_NULL)
|
||||
position = models.PositiveSmallIntegerField(_('Position'),
|
||||
blank=True, null=True)
|
||||
status = models.SmallIntegerField(_('status'), choices=STATUS_CHOICES,
|
||||
|
||||
30
content/news_urls.py
Normal file
30
content/news_urls.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Created on 03.10.2011
|
||||
|
||||
@author: christian
|
||||
"""
|
||||
from django.conf.urls import * # @UnusedWildImport
|
||||
|
||||
from .views import ArticleArchiveIndex, ArticleForm, ArticleYearArchive, \
|
||||
ArticleMonthArchive, ArticleDetail
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'content.views',
|
||||
url(r'^$', ArticleArchiveIndex.as_view(), name='article-archive'),
|
||||
url(r'^add/$', ArticleForm.as_view(), name='add-article'),
|
||||
url(r'^edit/(?P<pk>[\d]+)/$', ArticleForm.as_view(), name='edit-article'),
|
||||
url(r'^(?P<year>[\d]{4})/$', ArticleYearArchive.as_view(),
|
||||
name='article-archive'),
|
||||
url(r'^(?P<year>[\d]{4})/(?P<month>[\d]+)/$', ArticleMonthArchive.as_view(),
|
||||
name='article-archive'),
|
||||
url(r'^(?P<year>[\d]{4})/(?P<month>[\d]+)/(?P<slug>[\-\d\w]+)/$',
|
||||
ArticleDetail.as_view(), name='show-article'),
|
||||
url(r'^(?P<category>[\-\d\w]+)/$', ArticleArchiveIndex.as_view(),
|
||||
name='article-archive'),
|
||||
url(r'^(?P<category>[\-\d\w]+)/(?P<year>[\d]{4})/$',
|
||||
ArticleYearArchive.as_view(), name='article-archive'),
|
||||
url(r'^(?P<category>[\-\d\w]+)/(?P<year>[\d]{4})/(?P<month>[\d]+)/$',
|
||||
ArticleMonthArchive.as_view(), name='article-archive'),
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
from imagekit.specs import ImageSpec
|
||||
from imagekit import processors
|
||||
|
||||
|
||||
# noinspection PyPep8
|
||||
class ResizeArticle(processors.Resize):
|
||||
width = 210
|
||||
height = 130
|
||||
crop = True
|
||||
|
||||
|
||||
class Article(ImageSpec):
|
||||
pre_cache = True
|
||||
processors = [ResizeArticle]
|
||||
@@ -7,11 +7,10 @@
|
||||
|
||||
{% block opengraph %}
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="{{ article.headline }}" />
|
||||
<meta property="og:title" content="{{ article.headline|force_escape }}" />
|
||||
<meta property="og:url" content="http://www.kasu.at{{ article.get_absolute_url }}" />
|
||||
<meta property="og:image" content="http://www.kasu.at{{article.posting_image.url}}" />
|
||||
<meta property="og:description" content="{{article.content|striptags|truncatewords:25}}" />
|
||||
<meta property="og:description" content="{{article.content|striptags|truncatewords:25}}" />
|
||||
<meta property="og:description" content="{{article.content|striptags|truncatewords:25|force_escape}}" />
|
||||
<link rel="image_src" type="image/jpeg" href="{{article.posting_image.url}}" />
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ Created on 10.06.2012
|
||||
|
||||
@author: christian
|
||||
"""
|
||||
import copy
|
||||
|
||||
from django import template
|
||||
from django.utils.datastructures import SortedDict
|
||||
import copy
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
15
content/urls.py
Normal file
15
content/urls.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Created on 03.10.2011
|
||||
|
||||
@author: christian
|
||||
"""
|
||||
from django.conf.urls import * # @UnusedWildImport
|
||||
from .views import ImageList, PageList
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'content.views',
|
||||
url(r'^image_list.js$', ImageList.as_view(), name='content-image-list'),
|
||||
url(r'^link_list.js$', PageList.as_view(), name='content-page-list'),
|
||||
)
|
||||
@@ -1,15 +1,17 @@
|
||||
# Create your views here.
|
||||
from . import models, forms
|
||||
from aggregator.models import Feed
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import comments
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views import generic
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from . import models, forms
|
||||
from aggregator.models import Feed
|
||||
from utils.mixins import PermissionRequiredMixin
|
||||
import events.models
|
||||
import os
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
|
||||
class ArticleArchiveMixin(object):
|
||||
@@ -53,7 +55,8 @@ class ArticleYearArchive(ArticleArchiveMixin, generic.YearArchiveView):
|
||||
queryset = generic.YearArchiveView.get_queryset(self)
|
||||
self.category = self.kwargs.get('category')
|
||||
if self.category:
|
||||
self.category = get_object_or_404(models.Category, slug=self.category)
|
||||
self.category = get_object_or_404(models.Category,
|
||||
slug=self.category)
|
||||
queryset = queryset.filter(category=self.category)
|
||||
return queryset
|
||||
|
||||
@@ -98,7 +101,8 @@ class ImageList(generic.View):
|
||||
response = HttpResponse(content_type='text/javascript')
|
||||
response.write('var tinyMCEImageList = new Array(')
|
||||
os.chdir(settings.MEDIA_ROOT)
|
||||
for dirpath, dirnames, filenames in os.walk('images'): # @UnusedVariable @IgnorePep8
|
||||
for dirpath, dirnames, filenames in os.walk(
|
||||
'images'): # @UnusedVariable @IgnorePep8
|
||||
filenames.sort()
|
||||
for filename in filenames:
|
||||
image_list.append('["%(name)s", "%(path)s"]' % {
|
||||
|
||||
Reference in New Issue
Block a user