2017-10-24 21:31:08 -04:00
|
|
|
class Entry:
|
|
|
|
fields = ()
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def has(cls, field):
|
|
|
|
return field in cls.fields
|
|
|
|
|
|
|
|
|
|
|
|
class Note(Entry):
|
2017-10-24 21:01:52 -04:00
|
|
|
id = 'note'
|
|
|
|
icon = 'fa fa-paper-plane'
|
|
|
|
plural = 'notes'
|
|
|
|
|
|
|
|
|
2017-10-24 21:31:08 -04:00
|
|
|
class Article(Entry):
|
2017-10-24 21:01:52 -04:00
|
|
|
id = 'article'
|
|
|
|
icon = 'fa fa-file-text'
|
|
|
|
plural = 'articles'
|
2017-10-24 21:31:08 -04:00
|
|
|
fields = ('slug', 'name')
|
2017-10-24 21:01:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
all = (Note, Article)
|
|
|
|
from_id = {k.id: k for k in all}
|
|
|
|
from_plural = {k.plural: k for k in all}
|