2017-05-20 12:45:26 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
2017-12-18 12:54:04 +00:00
|
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
from django.core.validators import MaxLengthValidator
|
2017-05-20 12:45:26 +00:00
|
|
|
from django.db import models
|
2017-12-18 12:54:04 +00:00
|
|
|
from django.utils.html import mark_safe
|
|
|
|
|
|
|
|
from markdownx.models import MarkdownxField
|
2017-07-03 08:14:07 +00:00
|
|
|
from markdownx.utils import markdownify
|
2017-12-18 12:54:04 +00:00
|
|
|
import ox
|
2017-05-20 12:45:26 +00:00
|
|
|
|
|
|
|
# Create your models here.
|
|
|
|
|
|
|
|
class Acrolike(models.Model):
|
|
|
|
title = models.CharField(max_length=255)
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'acrolike'
|
|
|
|
|
|
|
|
|
|
|
|
class Acronym(models.Model):
|
|
|
|
name = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
c = models.CharField(max_length=50, blank=True, null=True)
|
|
|
|
a = models.CharField(max_length=50, blank=True, null=True)
|
|
|
|
m = models.CharField(max_length=50, blank=True, null=True)
|
|
|
|
p = models.CharField(max_length=50, blank=True, null=True)
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'acronym'
|
|
|
|
|
|
|
|
|
|
|
|
class Audios(models.Model):
|
|
|
|
filename = models.CharField(max_length=255)
|
|
|
|
title = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'audios'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Comments(models.Model): #not used
|
|
|
|
comment = models.TextField()
|
|
|
|
name = models.CharField(max_length=150, blank=True, null=True)
|
|
|
|
email = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
personid = models.IntegerField(db_column='personID', blank=True, null=True) # Field name made lowercase.
|
|
|
|
dateadded = models.DateTimeField(db_column='dateAdded') # Field name made lowercase.
|
|
|
|
datemodified = models.DateTimeField(db_column='dateModified', blank=True, null=True) # Field name made lowercase.
|
|
|
|
parentid = models.IntegerField(db_column='parentID', blank=True, null=True) # Field name made lowercase.
|
|
|
|
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
|
|
|
|
ip = models.CharField(db_column='IP', max_length=50, blank=True, null=True) # Field name made lowercase.
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'comments'
|
|
|
|
|
|
|
|
|
|
|
|
class Content(models.Model):
|
2017-05-24 11:44:04 +00:00
|
|
|
type = models.ForeignKey("ContentTypes", db_column="type")
|
2017-12-18 12:54:04 +00:00
|
|
|
shortname = models.CharField(db_column='shortName', max_length=255) # Field name made lowercase.
|
2017-05-20 12:45:26 +00:00
|
|
|
title = models.CharField(max_length=255)
|
2017-12-18 12:54:04 +00:00
|
|
|
header = MarkdownxField(blank=True, null=True, default='')
|
|
|
|
body = MarkdownxField(blank=True, null=True, default='')
|
|
|
|
teaser = models.TextField(blank=True, null=True, validators=[MaxLengthValidator(200)])
|
2017-05-24 11:44:04 +00:00
|
|
|
schedule = models.TextField(blank=True, null=True)
|
2017-05-20 12:45:26 +00:00
|
|
|
schedulebutton = models.CharField(db_column='scheduleButton', max_length=255, blank=True, null=True) # Field name made lowercase.
|
|
|
|
optbtn2 = models.CharField(db_column='optBtn2', max_length=127, blank=True, null=True) # Field name made lowercase.
|
|
|
|
opttext2 = models.TextField(db_column='optText2', blank=True, null=True) # Field name made lowercase.
|
|
|
|
optbtn3 = models.CharField(db_column='optBtn3', max_length=127, blank=True, null=True) # Field name made lowercase.
|
|
|
|
opttext3 = models.TextField(db_column='optText3', blank=True, null=True) # Field name made lowercase.
|
2017-06-10 09:59:00 +00:00
|
|
|
technotes = models.TextField(db_column='technotes', blank=True, null=True)
|
2017-05-20 12:45:26 +00:00
|
|
|
image = models.CharField(max_length=150, blank=True, null=True)
|
|
|
|
postedby = models.CharField(db_column='postedBy', max_length=50, blank=True, null=True) # Field name made lowercase.
|
|
|
|
datestart = models.DateField(db_column='dateStart', blank=True, null=True) # Field name made lowercase.
|
|
|
|
dateend = models.DateField(db_column='dateEnd', blank=True, null=True) # Field name made lowercase.
|
2017-12-18 12:54:04 +00:00
|
|
|
dateadded = models.DateTimeField(db_column='dateAdded', auto_now_add=True, editable=True) # Field name made lowercase.
|
|
|
|
datemodified = models.DateTimeField(db_column='dateModified', blank=True, null=True, auto_now=True) # Field name made lowercase.
|
|
|
|
published = models.BooleanField(default=False)
|
|
|
|
featured = models.BooleanField(default=False)
|
|
|
|
view = models.ForeignKey("Views", null=True, blank=True, db_column="view", editable=False)
|
2017-06-10 09:59:00 +00:00
|
|
|
place = models.CharField(max_length=255, null=True, blank=True)
|
2017-06-10 12:05:37 +00:00
|
|
|
parentid = models.IntegerField(null=True, db_column='parentID', blank=True) # Field name made lowercase.
|
2017-06-10 11:07:32 +00:00
|
|
|
parents = models.ManyToManyField('Content', through='ContentContent', related_name= "children")
|
2017-05-20 12:45:26 +00:00
|
|
|
|
2017-05-20 12:41:15 +00:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
2017-07-03 08:14:07 +00:00
|
|
|
@property
|
|
|
|
def formatted_header(self):
|
2017-12-18 12:54:04 +00:00
|
|
|
return mark_safe(markdownify(self.header))
|
2017-07-03 08:14:07 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def formatted_body(self):
|
2017-12-18 12:54:04 +00:00
|
|
|
return mark_safe(markdownify(self.body))
|
|
|
|
|
|
|
|
@property
|
|
|
|
def formatted_teaser(self):
|
|
|
|
if self.teaser:
|
|
|
|
value = self.teaser
|
|
|
|
elif self.header:
|
|
|
|
value = ox.strip_tags(ox.decode_html(self.header))[:100]
|
|
|
|
else:
|
|
|
|
value = ''
|
|
|
|
return mark_safe(value)
|
2017-07-03 08:14:07 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def typefilter(self):
|
|
|
|
return self.type
|
2017-12-18 12:54:04 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def image_url(self):
|
|
|
|
if self.image:
|
|
|
|
return settings.IMAGE_PREFIX + self.image
|
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
if self.shortname:
|
|
|
|
section = self.type.name
|
|
|
|
if section == 'news':
|
|
|
|
section = 'events'
|
|
|
|
if section == 'page':
|
|
|
|
return '/' + self.shortname
|
|
|
|
return '/%s/%s' %(section, self.shortname)
|
|
|
|
|
2017-07-03 08:14:07 +00:00
|
|
|
|
2017-05-20 12:45:26 +00:00
|
|
|
class Meta:
|
2017-05-24 11:44:04 +00:00
|
|
|
managed = True
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'content'
|
|
|
|
|
|
|
|
|
|
|
|
class ContentContent(models.Model):
|
2017-06-10 11:07:32 +00:00
|
|
|
contentid1 = models.ForeignKey("content", db_column='contentID1', related_name="child") # Field name made lowercase.
|
|
|
|
contentid2 = models.ForeignKey("content", db_column='contentID2', related_name="parent") # Field name made lowercase.
|
|
|
|
|
|
|
|
def __unicode__(self):
|
2017-07-03 08:14:07 +00:00
|
|
|
return self.contentid1.title
|
2017-05-20 12:45:26 +00:00
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'content_content'
|
|
|
|
|
|
|
|
|
|
|
|
class ContentKeyword(models.Model):
|
|
|
|
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
|
|
|
|
keywordid = models.IntegerField(db_column='keywordID') # Field name made lowercase.
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'content_keyword'
|
|
|
|
|
|
|
|
|
|
|
|
class ContentResource(models.Model):
|
|
|
|
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
|
|
|
|
resourceid = models.IntegerField(db_column='resourceID') # Field name made lowercase.
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'content_resource'
|
|
|
|
|
|
|
|
|
|
|
|
class ContentTypes(models.Model):
|
|
|
|
id = models.IntegerField(primary_key=True)
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
|
2017-05-24 11:44:04 +00:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2017-05-20 12:45:26 +00:00
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'content_types'
|
|
|
|
|
|
|
|
|
|
|
|
class Keywords(models.Model):
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'keywords'
|
|
|
|
|
|
|
|
|
|
|
|
class People(models.Model): #not used
|
|
|
|
name = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
email = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
location = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
login = models.CharField(max_length=100, blank=True, null=True)
|
|
|
|
password = models.CharField(max_length=16, blank=True, null=True)
|
|
|
|
href = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
bio = models.TextField(blank=True, null=True)
|
|
|
|
type = models.IntegerField()
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'people'
|
|
|
|
|
|
|
|
|
|
|
|
class PersonContent(models.Model):
|
|
|
|
personid = models.IntegerField(db_column='personID') # Field name made lowercase.
|
|
|
|
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
|
|
|
|
level = models.IntegerField()
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'person_content'
|
|
|
|
|
|
|
|
|
|
|
|
class PersonResource(models.Model):
|
|
|
|
personid = models.IntegerField(db_column='personID') # Field name made lowercase.
|
|
|
|
resourceid = models.IntegerField(db_column='resourceID') # Field name made lowercase.
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'person_resource'
|
|
|
|
|
|
|
|
|
|
|
|
class Resources(models.Model):
|
|
|
|
type = models.IntegerField()
|
|
|
|
href = models.CharField(max_length=255)
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
mime = models.CharField(max_length=10, blank=True, null=True)
|
|
|
|
width = models.IntegerField(blank=True, null=True)
|
|
|
|
height = models.IntegerField(blank=True, null=True)
|
|
|
|
istech = models.IntegerField(db_column='isTech') # Field name made lowercase.
|
2017-06-10 12:05:37 +00:00
|
|
|
dateadded = models.DateTimeField(db_column='dateAdded', null=True, blank=True) # Field name made lowercase.
|
2017-05-20 12:45:26 +00:00
|
|
|
orderno = models.IntegerField(db_column='orderNo', blank=True, null=True) # Field name made lowercase.
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'resources'
|
|
|
|
|
2017-06-10 12:05:37 +00:00
|
|
|
class File(models.Model):
|
|
|
|
content = models.ForeignKey('Content')
|
|
|
|
fil = models.FileField(upload_to='files')
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
date = models.DateTimeField(auto_now_add=True)
|
|
|
|
order = models.IntegerField(blank=True, null=True)
|
|
|
|
|
|
|
|
class Image(models.Model):
|
|
|
|
content = models.ForeignKey('Content', related_name='images')
|
2017-07-03 08:14:07 +00:00
|
|
|
image = models.ImageField(upload_to='camp/static/images')
|
2017-06-10 12:05:37 +00:00
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
date = models.DateTimeField(auto_now_add=True)
|
|
|
|
order = models.IntegerField(blank=True, null=True)
|
|
|
|
|
|
|
|
class Link(models.Model):
|
|
|
|
content = models.ForeignKey('Content')
|
|
|
|
url = models.URLField()
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
date = models.DateTimeField(auto_now_add=True)
|
|
|
|
order = models.IntegerField(blank=True, null=True)
|
2017-05-20 12:45:26 +00:00
|
|
|
|
|
|
|
class Videos(models.Model): # not used
|
|
|
|
sha1 = models.CharField(max_length=50)
|
|
|
|
href = models.CharField(max_length=255)
|
|
|
|
title = models.TextField(blank=True, null=True)
|
|
|
|
description = models.TextField(blank=True, null=True)
|
|
|
|
width = models.IntegerField(blank=True, null=True)
|
|
|
|
height = models.IntegerField(blank=True, null=True)
|
|
|
|
duration = models.IntegerField(blank=True, null=True)
|
|
|
|
thumbno = models.IntegerField(db_column='thumbNo') # Field name made lowercase.
|
|
|
|
image = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
contentid = models.IntegerField(blank=True, null=True)
|
|
|
|
|
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'videos'
|
|
|
|
|
|
|
|
|
|
|
|
class Views(models.Model):
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
href = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
|
2017-05-24 11:44:04 +00:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2017-05-20 12:45:26 +00:00
|
|
|
class Meta:
|
2017-06-10 12:05:37 +00:00
|
|
|
# managed = False
|
2017-05-20 12:45:26 +00:00
|
|
|
db_table = 'views'
|
|
|
|
|
2017-07-03 08:14:07 +00:00
|
|
|
|
|
|
|
class MyModel(models.Model):
|
|
|
|
myfield = MarkdownxField()
|
|
|
|
|
|
|
|
|
|
|
|
|