summaryrefslogtreecommitdiff
path: root/app/posts/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/posts/models.py')
-rw-r--r--app/posts/models.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/app/posts/models.py b/app/posts/models.py
index d4000d9..7e05ebb 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -36,7 +36,7 @@ from utils.util import render_images, render_products, parse_video, markdown_to_
class Post(models.Model):
old_id = models.IntegerField(blank=True, null=True)
title = models.CharField(max_length=200)
- short_title = models.CharField(max_length=200)
+ short_title = models.CharField(max_length=200, blank=True, null=True)
subtitle = models.CharField(max_length=200, blank=True)
slug = models.SlugField(unique_for_date='pub_date')
prologue_markdown = models.TextField(blank=True, null=True)
@@ -63,10 +63,12 @@ class Post(models.Model):
(0, 'field test'),
(1, 'review'),
(2, 'essay'),
+ (3, 'src'),
)
post_type = models.IntegerField(choices=POST_TYPE, default=0)
template_name = models.IntegerField(choices=TEMPLATES, default=0)
has_video = models.BooleanField(blank=True, default=False)
+ has_code = models.BooleanField(blank=True, default=False)
disclaimer = models.BooleanField(blank=True, default=True)
books = models.ManyToManyField(Book, blank=True)
field_notes = models.ManyToManyField(FieldNote, blank=True)
@@ -209,3 +211,22 @@ class PostSitemap(Sitemap):
def lastmod(self, obj):
return obj.pub_date
+
+"""
+for p in src:
+ s, created = Post.objects.get_or_create(
+ title=p.title,
+ slug=p.slug,
+ body_markdown=p.body_markdown,
+ pub_date=p.pub_date,
+ enable_comments=p.enable_comments,
+ has_code=p.has_code,
+ status=p.status,
+ meta_description=p.meta_description,
+ post_type=3,
+ )
+ print(p)
+ for t in p.topics.all():
+ c = Category.objects.get(slug=t.slug)
+ s.topics.add(c)
+"""