mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-06 09:57:57 +00:00

"submitter", thus making it possible for a single person to manage multiple organisations, as well as for a single organisation to have multiple different manages. Re-hook events and news items to use organisation of the submitter instead of the user who did the submission. (product listings already did this)
24 lines
766 B
Python
24 lines
766 B
Python
from django.db import models
|
|
from datetime import date
|
|
from pgweb.core.models import Organisation
|
|
from pgweb.util.bases import PgModel
|
|
|
|
class NewsArticle(PgModel, models.Model):
|
|
org = models.ForeignKey(Organisation, null=False, blank=False)
|
|
approved = models.BooleanField(null=False, blank=False, default=False)
|
|
date = models.DateField(null=False, blank=False, default=date.today)
|
|
title = models.CharField(max_length=200, null=False, blank=False)
|
|
content = models.TextField(null=False, blank=False)
|
|
|
|
send_notification = True
|
|
markdown_fields = ('content',)
|
|
|
|
def __unicode__(self):
|
|
return "%s: %s" % (self.date, self.title)
|
|
|
|
def verify_submitter(self, user):
|
|
return (len(self.org.managers.filter(pk=user.pk)) == 1)
|
|
|
|
class Meta:
|
|
ordering = ('-date',)
|