Article import bug

remotes/origin/1203
Назар Котюк 11 years ago
parent 504d9f5f43
commit 15bf139904
  1. 2
      article/management/commands/articles_from_old.py
  2. 6
      article/models.py
  3. 4
      templates/client/article/article.html

@ -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'],

@ -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):

@ -19,8 +19,8 @@
{% include 'includes/article/article_logo.html' with obj=object %}
<h1>{{ object.main_title }}</h1>
<strong><span>{{ object.publish_date }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong>
{{ object.description }}
<strong><span>{{ object.created }}</span><a class="profile_link" href="{{ object.author.get_permanent_url }}" title="">{{ object.author.get_full_name }}</a></strong>
{{ object.description|safe }}
<div class="blog_avtor">
<table>

Loading…
Cancel
Save