Files
postgres-web/pgweb/util/moderation.py
Magnus Hagander 2952b39754 Replace interactive docs with docs bug reporting
Per discussion from a long time ago, interactive docs aren't really
working out. The majority of submissions are either support questions
(which then get rejected because they cannot be answered in this
context) or pointing out docs incorrectnesses (which should be submitted
as a docs bug instead, so they can actually be fixed in the main
documentation).

Old references to /interactive/ will get redirected to /static/
automatically, and we expect to keep doing that for a long time (since
there are many links to them around the net).
2016-05-19 10:42:44 -04:00

27 lines
995 B
Python

# models needed to generate unapproved list
from pgweb.news.models import NewsArticle
from pgweb.events.models import Event
from pgweb.core.models import Organisation
from pgweb.downloads.models import Product
from pgweb.profserv.models import ProfessionalService
from pgweb.quotes.models import Quote
# Pending moderation requests (including URLs for the admin interface))
def _get_unapproved_list(objecttype):
objects = objecttype.objects.filter(approved=False)
if not len(objects): return None
return { 'name': objects[0]._meta.verbose_name_plural, 'entries':
[{'url': '/admin/%s/%s/%s/' % (x._meta.app_label, x._meta.model_name, x.pk), 'title': unicode(x)} for x in objects]
}
def get_all_pending_moderations():
applist = [
_get_unapproved_list(NewsArticle),
_get_unapproved_list(Event),
_get_unapproved_list(Organisation),
_get_unapproved_list(Product),
_get_unapproved_list(ProfessionalService),
_get_unapproved_list(Quote),
]
return [x for x in applist if x]