From 15bf139904383df8dc5810baa19b1f7bb17c5c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B7=D0=B0=D1=80=20=D0=9A=D0=BE=D1=82=D1=8E?= =?UTF-8?q?=D0=BA?= Date: Thu, 19 Feb 2015 19:39:47 +0200 Subject: [PATCH] Article import bug --- article/management/commands/articles_from_old.py | 2 ++ article/models.py | 6 +++--- templates/client/article/article.html | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/article/management/commands/articles_from_old.py b/article/management/commands/articles_from_old.py index 358a13fe..f2034aa2 100644 --- a/article/management/commands/articles_from_old.py +++ b/article/management/commands/articles_from_old.py @@ -16,6 +16,7 @@ class Command(BaseCommand): charset='utf8', cursorclass=DictCursor) cursor = db.cursor() + sql = """SELECT articles_description.articles_id as id , articles_description.articles_name as main_title, articles_description.articles_description as description, @@ -36,6 +37,7 @@ class Command(BaseCommand): result = cursor.fetchall() user = User.objects.get(id=1) + Article.objects.blogs().delete() for a in result: article = Article(type=Article.blog, id=a['id'], diff --git a/article/models.py b/article/models.py index 759639bd..5f8c2eae 100644 --- a/article/models.py +++ b/article/models.py @@ -83,7 +83,7 @@ class Article(TranslatableModel): translations = TranslatedFields( main_title = models.CharField(max_length=255), preview = models.TextField(), - description = models.TextField(), + description = models.TextField(blank=False), #-----meta title = models.CharField(max_length=255, blank=True), descriptions = models.CharField(max_length=255, blank=True), @@ -121,8 +121,8 @@ class Article(TranslatableModel): self.slug = self.generate_unique_slug() #Set the description field on save. - if self.gen_description: - self.description = strip_tags(self.description_from_content()) + #if self.gen_description: + # self.description = strip_tags(self.description_from_content()) super(Article, self).save(*args, **kwargs) def description_from_content(self): diff --git a/templates/client/article/article.html b/templates/client/article/article.html index ca764f21..534673d0 100644 --- a/templates/client/article/article.html +++ b/templates/client/article/article.html @@ -19,8 +19,8 @@ {% include 'includes/article/article_logo.html' with obj=object %}

{{ object.main_title }}

- {{ object.publish_date }}{{ object.author.get_full_name }} - {{ object.description }} + {{ object.created }}{{ object.author.get_full_name }} + {{ object.description|safe }}