mirror of
https://github.com/taroved/pol
synced 2025-05-21 16:40:15 -07:00
posts data removed
This commit is contained in:
parent
04b26b8eee
commit
b468a66316
25
frontend/frontend/migrations/0005_auto_20180131_1949.py
Normal file
25
frontend/frontend/migrations/0005_auto_20180131_1949.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('frontend', '0004_feed_edited'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='postfield',
|
||||||
|
name='field',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='postfield',
|
||||||
|
name='post',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='PostField',
|
||||||
|
),
|
||||||
|
]
|
@ -22,8 +22,3 @@ class Post(models.Model):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
index_together = ['feed', 'md5sum']
|
index_together = ['feed', 'md5sum']
|
||||||
|
|
||||||
class PostField(models.Model):
|
|
||||||
post = models.ForeignKey(Post, on_delete=models.CASCADE)
|
|
||||||
field = models.ForeignKey(Field, on_delete=models.CASCADE)
|
|
||||||
text = models.TextField(max_length=64*1024-1)
|
|
@ -34,12 +34,7 @@ class Feed(object):
|
|||||||
with conn as cur:
|
with conn as cur:
|
||||||
cur.execute("""insert into frontend_post (md5sum, created, feed_id)
|
cur.execute("""insert into frontend_post (md5sum, created, feed_id)
|
||||||
values (%s, %s, %s)""", (post_fields['md5'], created, feed_id))
|
values (%s, %s, %s)""", (post_fields['md5'], created, feed_id))
|
||||||
|
|
||||||
post_id = conn.insert_id()
|
post_id = conn.insert_id()
|
||||||
for key in ['title', 'description', 'title_link']:
|
|
||||||
if key in post_fields:
|
|
||||||
cur.execute("""insert into frontend_postfield (field_id, post_id, `text`)
|
|
||||||
values (%s, %s, %s)""", (self.FIELD_IDS[key], post_id, post_fields[key].encode('utf-8')))
|
|
||||||
log.info('Post saved id:{id!r}', id=post_id)
|
log.info('Post saved id:{id!r}', id=post_id)
|
||||||
|
|
||||||
def fill_time(self, feed_id, items):
|
def fill_time(self, feed_id, items):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user