2021-11-12 16:49:35 +00:00
|
|
|
from django.db import models
|
2021-11-12 17:17:59 +00:00
|
|
|
from django.conf import settings
|
|
|
|
|
2021-11-12 16:49:35 +00:00
|
|
|
import ox
|
|
|
|
|
|
|
|
class Event(models.Model):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('position', )
|
|
|
|
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
|
|
modified = models.DateTimeField(auto_now=True)
|
|
|
|
|
|
|
|
slug = models.SlugField(blank=True, unique=True)
|
|
|
|
|
|
|
|
position = models.IntegerField(default=0)
|
|
|
|
title = models.TextField(blank=True)
|
|
|
|
type = models.CharField(blank=True, default='', max_length=1024)
|
|
|
|
date = models.CharField(blank=True, null=True, max_length=1024)
|
|
|
|
body = models.TextField(blank=True, null=True)
|
2021-11-12 16:58:31 +00:00
|
|
|
media = models.TextField(blank=True, null=True)
|
2021-11-12 16:49:35 +00:00
|
|
|
|
|
|
|
data = models.JSONField(default=dict, blank=True, editable=False)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return '%s (%s)' % (ox.strip_tags(self.title), self.slug)
|
|
|
|
|
|
|
|
def get_absolute_url(self):
|
2021-11-12 17:17:59 +00:00
|
|
|
return '/' + settings.URL_PREFIX + '#' + self.slug
|