Files
postgres-web/pgweb/contributors/models.py
Magnus Hagander 5f784d0e64 Make it possible for a contributor to edit his/her own data
Only for users that are already listed under /community/contributors/,
make it possible to edit this data, so we don't have to track it manually.
For obvious reasons, we don't allow editing of the "contributor level"
field...

This also changes the contributors model to send a notification to
the slaves list whenever a contributor record is changed, so we can do
post-moderation if necessary.
2013-12-29 14:52:43 +01:00

39 lines
1.3 KiB
Python

from django.db import models
from django.contrib.auth.models import User
from pgweb.util.bases import PgModel
class ContributorType(PgModel, models.Model):
typename = models.CharField(max_length=32, null=False, blank=False)
sortorder = models.IntegerField(null=False, default=100)
extrainfo = models.TextField(null=True, blank=True)
detailed = models.BooleanField(null=False, default=True)
purge_urls = ('/community/contributors/', )
def __unicode__(self):
return self.typename
class Meta:
ordering = ('sortorder',)
class Contributor(PgModel, models.Model):
ctype = models.ForeignKey(ContributorType)
lastname = models.CharField(max_length=100, null=False, blank=False)
firstname = models.CharField(max_length=100, null=False, blank=False)
email = models.EmailField(null=False, blank=False)
company = models.CharField(max_length=100, null=True, blank=True)
companyurl = models.URLField(max_length=100, null=True, blank=True, verbose_name='Company URL')
location = models.CharField(max_length=100, null=True, blank=True)
contribution = models.TextField(null=True, blank=True)
user = models.ForeignKey(User, null=True, blank=True)
send_notification=True
purge_urls = ('/community/contributors/', )
def __unicode__(self):
return "%s %s" % (self.firstname, self.lastname)
class Meta:
ordering = ('lastname', 'firstname',)