2017-10-24 21:31:08 -04:00
|
|
|
class Entry:
|
2017-11-12 16:54:23 -05:00
|
|
|
def __init__(self, id, plural, icon, on_home=True, slug=False):
|
2017-10-25 18:01:36 -04:00
|
|
|
self.id = id
|
|
|
|
self.plural = plural
|
|
|
|
self.icon = icon
|
2017-11-12 16:54:23 -05:00
|
|
|
self.on_home = on_home
|
2017-10-27 01:51:46 -04:00
|
|
|
self.slug = slug
|
2017-10-24 21:31:08 -04:00
|
|
|
|
2017-10-25 18:01:36 -04:00
|
|
|
@property
|
|
|
|
def index(self):
|
|
|
|
return self.plural + '_index'
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-25 18:01:36 -04:00
|
|
|
@property
|
|
|
|
def entry(self):
|
|
|
|
return self.plural + '_entry'
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-31 18:29:59 -04:00
|
|
|
@property
|
|
|
|
def atom(self):
|
|
|
|
return self.plural + '_atom'
|
|
|
|
|
|
|
|
@property
|
|
|
|
def rss(self):
|
|
|
|
return self.plural + '_rss'
|
|
|
|
|
2017-10-25 18:01:36 -04:00
|
|
|
|
|
|
|
Note = Entry(
|
|
|
|
id='note',
|
2017-12-05 22:07:59 -05:00
|
|
|
icon='fas fa-paper-plane',
|
2017-10-25 18:01:36 -04:00
|
|
|
plural='notes',
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
Article = Entry(
|
|
|
|
id='article',
|
2017-12-05 22:07:59 -05:00
|
|
|
icon='fas fa-file-alt',
|
2017-10-25 18:01:36 -04:00
|
|
|
plural='articles',
|
2017-10-27 01:51:46 -04:00
|
|
|
slug=True,
|
2017-10-25 18:01:36 -04:00
|
|
|
)
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-27 01:04:05 -04:00
|
|
|
Photo = Entry(
|
|
|
|
id='photo',
|
2017-12-05 22:07:59 -05:00
|
|
|
icon='fas fa-camera',
|
2017-10-27 01:04:05 -04:00
|
|
|
plural='photos',
|
|
|
|
)
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-11-12 16:42:31 -05:00
|
|
|
Reply = Entry(
|
|
|
|
id='reply',
|
2017-12-05 22:07:59 -05:00
|
|
|
icon='fas fa-comment',
|
2017-11-12 16:42:31 -05:00
|
|
|
plural='replies',
|
2017-11-12 16:54:23 -05:00
|
|
|
on_home=False,
|
2017-11-12 16:42:31 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
Like = Entry(
|
|
|
|
id='like',
|
2017-12-05 22:07:59 -05:00
|
|
|
icon='fas fa-heart',
|
2017-11-12 16:42:31 -05:00
|
|
|
plural='likes',
|
2017-11-12 16:54:23 -05:00
|
|
|
on_home=False,
|
2017-11-12 16:42:31 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
Repost = Entry(
|
|
|
|
id='repost',
|
2017-12-05 22:07:59 -05:00
|
|
|
icon='fas fa-retweet',
|
2017-11-12 16:42:31 -05:00
|
|
|
plural='reposts',
|
|
|
|
)
|
|
|
|
|
2017-11-19 19:26:15 -05:00
|
|
|
all = (Note, Article, Photo)
|
2017-11-12 16:56:20 -05:00
|
|
|
on_home = {k.id for k in all if k.on_home}
|
2017-10-24 21:01:52 -04:00
|
|
|
from_id = {k.id: k for k in all}
|
|
|
|
from_plural = {k.plural: k for k in all}
|