Begin implementing support for replies, likes, and reposts - there's a DB field for storing the original post's URL, but it's not actually used yet
This commit is contained in:
parent
5d031f9e84
commit
28e4a71cae
3 changed files with 49 additions and 1 deletions
|
@ -42,6 +42,24 @@ Photo = Entry(
|
||||||
plural='photos',
|
plural='photos',
|
||||||
)
|
)
|
||||||
|
|
||||||
all = (Note, Article, Photo)
|
Reply = Entry(
|
||||||
|
id='reply',
|
||||||
|
icon='fa fa-comment',
|
||||||
|
plural='replies',
|
||||||
|
)
|
||||||
|
|
||||||
|
Like = Entry(
|
||||||
|
id='like',
|
||||||
|
icon='fa fa-heart',
|
||||||
|
plural='likes',
|
||||||
|
)
|
||||||
|
|
||||||
|
Repost = Entry(
|
||||||
|
id='repost',
|
||||||
|
icon='fa fa-retweet',
|
||||||
|
plural='reposts',
|
||||||
|
)
|
||||||
|
|
||||||
|
all = (Note, Article, Photo, Reply, Like, Repost)
|
||||||
from_id = {k.id: k for k in all}
|
from_id = {k.id: k for k in all}
|
||||||
from_plural = {k.plural: k for k in all}
|
from_plural = {k.plural: k for k in all}
|
||||||
|
|
25
entries/migrations/0007_auto_20171113_0841.py
Normal file
25
entries/migrations/0007_auto_20171113_0841.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.7 on 2017-11-12 21:41
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('entries', '0006_auto_20171102_1200'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='entry',
|
||||||
|
name='cite',
|
||||||
|
field=models.CharField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='entry',
|
||||||
|
name='kind',
|
||||||
|
field=models.CharField(choices=[('note', 'note'), ('article', 'article'), ('photo', 'photo'), ('reply', 'reply'), ('like', 'like'), ('repost', 'repost')], db_index=True, default='note', max_length=30),
|
||||||
|
),
|
||||||
|
]
|
|
@ -34,6 +34,11 @@ class Entry(ModelMeta, TimeStampedModel):
|
||||||
photo = models.ImageField(blank=True)
|
photo = models.ImageField(blank=True)
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
|
|
||||||
|
# The URL of an entry (anywhere on the web) that should become an embedded
|
||||||
|
# h-cite. Can become a u-like-of, u-repost-of, or u-in-reply-to depending
|
||||||
|
# on the post type.
|
||||||
|
cite = models.CharField(max_length=255, blank=True)
|
||||||
|
|
||||||
author = models.ForeignKey(
|
author = models.ForeignKey(
|
||||||
get_user_model(),
|
get_user_model(),
|
||||||
related_name='entries',
|
related_name='entries',
|
||||||
|
|
Loading…
Reference in a new issue