mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-10 00:42:06 +00:00
Implement basic varnish purging
This allows all models inherited from PgModel to specify which URLs to purge by either setting a field or defining a function called purge_urls, at which point they will be purged whenever the save signal is fired. Also implements a form under /admin/purge/ that allows for manual purging. This should probably be extended in the future to show the status of the pgq slaves, but that will come later. Includes a SQL function that posts the expires to a pgq queue. For a local deployment, this can be replaced with a simple void function to turn off varnish purging.
This commit is contained in:
@ -1,16 +1,20 @@
|
||||
from django.db import models
|
||||
|
||||
class MailingListGroup(models.Model):
|
||||
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/', )
|
||||
|
||||
def __unicode__(self):
|
||||
return self.groupname
|
||||
|
||||
class Meta:
|
||||
ordering = ('sortkey', )
|
||||
|
||||
class MailingList(models.Model):
|
||||
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)
|
||||
@ -18,6 +22,8 @@ class MailingList(models.Model):
|
||||
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:
|
||||
|
Reference in New Issue
Block a user