mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-03 15:38:59 +00:00

This is used so we can reference the group as a negative id number from a template, which is the standard way we separate it from lists when included in the same dropdowns.
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
from django.db import models
|
|
|
|
from pgweb.util.bases import PgModel
|
|
|
|
class MailingListGroup(PgModel, models.Model):
|
|
groupname = models.CharField(max_length=64, null=False, blank=False)
|
|
sortkey = models.IntegerField(null=False, default=10)
|
|
|
|
purge_urls = ('/community/lists/', )
|
|
|
|
@property
|
|
def negid(self):
|
|
return -self.id
|
|
|
|
def __unicode__(self):
|
|
return self.groupname
|
|
|
|
class Meta:
|
|
ordering = ('sortkey', )
|
|
|
|
class MailingList(PgModel, models.Model):
|
|
group = models.ForeignKey(MailingListGroup, null=False)
|
|
listname = models.CharField(max_length=64, null=False, blank=False)
|
|
active = models.BooleanField(null=False, default=False)
|
|
externallink = models.URLField(max_length=200, null=True, blank=True)
|
|
description = models.TextField(null=False, blank=True)
|
|
shortdesc = models.TextField(null=False, blank=True)
|
|
|
|
purge_urls = ('/community/lists/', )
|
|
|
|
@property
|
|
def maybe_shortdesc(self):
|
|
if self.shortdesc:
|
|
return self.shortdesc
|
|
return self.listname
|
|
|
|
def __unicode__(self):
|
|
return self.listname
|
|
|
|
class Meta:
|
|
ordering = ('listname', )
|