Files
postgres-web/pgweb/news/models.py
Magnus Hagander 7b3bb5d09b Make organisations support multiple "managers" and not just one
"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)
2010-02-26 12:34:19 +01:00

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',)