Files
postgres-web/pgweb/news/forms.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

15 lines
435 B
Python

from django import forms
from pgweb.core.models import Organisation
from models import NewsArticle
class NewsArticleForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(NewsArticleForm, self).__init__(*args, **kwargs)
def filter_by_user(self, user):
self.fields['org'].queryset = Organisation.objects.filter(managers=user, approved=True)
class Meta:
model = NewsArticle
exclude = ('submitter', 'approved', )