Events und Gallery in einzelne Apps aufgetielt.

Lokalisierung auf einzelne Apps aufgeteilt
Mai-Star Ranking in die Navigation integriert
This commit is contained in:
Christian Berg
2014-12-09 23:19:04 +01:00
parent 34f5bdca58
commit 2011d3ce25
1084 changed files with 4905 additions and 7628 deletions

View File

@@ -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!"