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:
Danielle McLean 2017-11-13 08:42:31 +11:00
parent 5d031f9e84
commit 28e4a71cae
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
3 changed files with 49 additions and 1 deletions

View file

@ -42,6 +42,24 @@ Photo = Entry(
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_plural = {k.plural: k for k in all}

View 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),
),
]

View file

@ -34,6 +34,11 @@ class Entry(ModelMeta, TimeStampedModel):
photo = models.ImageField(blank=True)
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(
get_user_model(),
related_name='entries',