@@ -44,25 +44,26 @@ class Page(models.Model):
@property
def is_community(self):
return self.path.lower().startswith("community/")
def save(self, *args, **kwargs):
self.updated = datetime.datetime.now()
super(Page, self).save(*args, **kwargs)
def clean_fields(self, exclude=None):
super(Page, self).clean_fields(exclude)
if not re.match(settings.SYMPOSION_PAGE_REGEX, self.path):
raise ValidationError({"path": [_("Path can only contain letters, numbers and hyphens and end with /")]})
raise ValidationError(
{"path": [_("Path can only contain letters, numbers and hyphens and end with /")]})
reversion.register(Page)
def generate_filename(instance, filename):
return filename
class File(models.Model):
file = models.FileField(upload_to=generate_filename)