2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 20:20:58 +00:00

Add news reader (#3445)

* add model for feed entries

* add task to update feed entries

* Add API routes

* Fix name in model

* rename model

* fix read endpoint

* reduce duplication in NewsFeed API endpoints

* reduce duplicated code

* add ui elements to index

* add missing migrations

* add ressource route

* add new model to admin

* reorder fields

* format timestamp

* make title linked

* reduce migrations to 1

* fix merge

* fix js style

* add model to ruleset
This commit is contained in:
Matthias Mair
2022-11-10 02:20:06 +01:00
committed by GitHub
parent f6cfc12343
commit fb77158496
15 changed files with 291 additions and 33 deletions

View File

@ -1560,6 +1560,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
'validator': bool,
},
'HOMEPAGE_NEWS': {
'name': _('Show News'),
'description': _('Show news on the homepage'),
'default': False,
'validator': bool,
},
"LABEL_INLINE": {
'name': _('Inline label display'),
'description': _('Display PDF labels in the browser, instead of downloading as a file'),
@ -2285,3 +2292,54 @@ class NotificationMessage(models.Model):
def age_human(self):
"""Humanized age."""
return naturaltime(self.creation)
class NewsFeedEntry(models.Model):
"""A NewsFeedEntry represents an entry on the RSS/Atom feed that is generated for InvenTree news.
Attributes:
- feed_id: Unique id for the news item
- title: Title for the news item
- link: Link to the news item
- published: Date of publishing of the news item
- author: Author of news item
- summary: Summary of the news items content
- read: Was this iteam already by a superuser?
"""
feed_id = models.CharField(
verbose_name=_('Id'),
unique=True,
max_length=250,
)
title = models.CharField(
verbose_name=_('Title'),
max_length=250,
)
link = models.URLField(
verbose_name=_('Link'),
max_length=250,
)
published = models.DateTimeField(
verbose_name=_('Published'),
max_length=250,
)
author = models.CharField(
verbose_name=_('Author'),
max_length=250,
)
summary = models.CharField(
verbose_name=_('Summary'),
max_length=250,
)
read = models.BooleanField(
verbose_name=_('Read'),
help_text=_('Was this news item read?'),
default=False
)