diff options
author | Magnus Hagander | 2018-09-23 12:45:09 +0000 |
---|---|---|
committer | Magnus Hagander | 2018-09-23 12:58:22 +0000 |
commit | 24783dd60dee1fa9672c2e3fdefe5ab539378553 (patch) | |
tree | 46e35a850d5b53462c409a98d597ee74929e7f36 /postgresqleu/newsevents/admin.py | |
parent | 3dbfc16a68cff303f9e8ed41974db6377aa375a7 (diff) |
Revamp and expand news handling
A number of improvements and unifications for news:
* News posts now get authors
* Authors are from NewsPosterProfile:s, which will include a full name
and an "urlname"
* Authors can also be specified as "can post global", which should
give rights to post on the global feed. Right now the global feed
requires superuser access anwyay, but for the future...
* News can now be posted at conference level as well as previous
global only
* Front page of website pulls in a combination of global news and
conference news. Global news can be given a "high priority until"
field that ensure it sits at the top of the frontpage until a
certain date, so conference news can't push it off.
* Each conference gets it's own RSS feed. This one is also available
via JSON for an easy way to pull it into the conference site itself.
* All links to posts in the conference feed goes to the conference
homepage. It's really only designed for transient news.
* Each user also gets it's own RSS feed. This is designed so that it
can be submitted to an aggregator like Planet PostgreSQL which
requires personal feeds. Conference specific news are automatically
prefixed by conference name.
* Each post can individually be toggled if it should be included in
the RSS feed or not
* Re-adds the news archive, with a paginated view
* Each post can individually be toggled for inclusion in the news
archive, so it's possible to create more transient news. News
archive *only* contains news from the global feed, not the
conference feeds.
* Makes the "read more" button on the frontpage only show up if the
entire news post did not fit
Diffstat (limited to 'postgresqleu/newsevents/admin.py')
-rw-r--r-- | postgresqleu/newsevents/admin.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/postgresqleu/newsevents/admin.py b/postgresqleu/newsevents/admin.py index 56a20021..b95ddf1d 100644 --- a/postgresqleu/newsevents/admin.py +++ b/postgresqleu/newsevents/admin.py @@ -1,4 +1,27 @@ from django.contrib import admin -from postgresqleu.newsevents.models import News + +from selectable.forms.widgets import AutoCompleteSelectWidget + +from postgresqleu.accountinfo.lookups import UserLookup +from postgresqleu.util.forms import ConcurrentProtectedModelForm +from postgresqleu.util.admin import SelectableWidgetAdminFormMixin + +from postgresqleu.newsevents.models import News, NewsPosterProfile + +class NewsPosterProfileForm(SelectableWidgetAdminFormMixin, ConcurrentProtectedModelForm): + class Meta: + model = NewsPosterProfile + exclude = [] + widgets = { + 'author': AutoCompleteSelectWidget(lookup_class=UserLookup), + } + +class NewsPosterProfileAdmin(admin.ModelAdmin): + form = NewsPosterProfileForm + list_display = ('__unicode__', 'rsslink') + + def rsslink(self, author): + return "/feeds/user/{0}/".format(author.urlname) admin.site.register(News) +admin.site.register(NewsPosterProfile, NewsPosterProfileAdmin) |