143 lines
4.4 KiB
Python
143 lines
4.4 KiB
Python
from django.db import models
|
|
import datetime
|
|
import time
|
|
from ckeditor.fields import RichTextField
|
|
from app.models import ItfModel
|
|
|
|
class Comment(models.Model):
|
|
name = models.CharField(max_length=255)
|
|
email = models.EmailField(max_length=255)
|
|
comment = models.TextField()
|
|
is_displayed = models.BooleanField(default=True)
|
|
meeting = models.ForeignKey('Meeting')
|
|
parent = models.ForeignKey('Comment', default=0, related_name='child')
|
|
posted_date = models.DateTimeField(default=datetime.datetime.now())
|
|
|
|
def __unicode__(self):
|
|
return "%s by %s on %s" % (self.comment, self.name, self.posted_date,)
|
|
|
|
def epoch_date(self):
|
|
return time.mktime(self.posted_date.timetuple())
|
|
|
|
|
|
class CommentCaptcha(models.Model):
|
|
question = models.CharField(max_length=500)
|
|
answer = models.CharField(max_length=10)
|
|
|
|
def __unicode__(self):
|
|
return self.question
|
|
|
|
#Not using this class right now - but use this as a constant reminder ...
|
|
# class CommentVote(models.Model):
|
|
|
|
|
|
class Meeting(ItfModel):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
slug = models.SlugField()
|
|
fts_fields = ['title', 'intro']
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class Participant(models.Model):
|
|
name = models.CharField(max_length=255)
|
|
title = models.CharField(max_length=255, blank=True, null=True)
|
|
short_bio = models.TextField(max_length=255, blank=True, null=True)
|
|
meeting = models.ForeignKey('Meeting')
|
|
|
|
def __unicode__(self):
|
|
return self.name
|
|
|
|
class Talk(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
presenter = models.CharField(max_length=255)
|
|
session = models.ForeignKey('Session') # name of meeting - name of session
|
|
|
|
def __unicode__(self):
|
|
return "%s - %s" % (self.session.day.meeting.title, self.title) # name of meeting - name of session
|
|
|
|
class Session(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
day = models.ForeignKey('MeetingDay')
|
|
session_no = models.IntegerField(blank=True, null=True)
|
|
|
|
def __unicode__(self):
|
|
return "%s - %s" % (self.day.meeting.title, self.title) # name of meeting - name of session
|
|
|
|
class MeetingDay(models.Model):
|
|
meeting = models.ForeignKey('Meeting')
|
|
meeting_date = models.DateField()
|
|
|
|
def __unicode__(self):
|
|
return "%s - %s" % (self.meeting, self.meeting_date)
|
|
|
|
class Audio(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
file = models.FileField(upload_to='upload/audio')
|
|
meeting = models.ForeignKey('Meeting', blank=True, null=True)
|
|
talk = models.ForeignKey('Talk', blank=True, null=True)
|
|
|
|
class Meta:
|
|
verbose_name_plural = "Audio"
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class Video(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
file = models.FileField(upload_to='upload/video')
|
|
meeting = models.ForeignKey('Meeting', blank=True, null=True)
|
|
talk = models.ForeignKey('Talk', blank=True, null=True)
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class PadmaVideo(models.Model):
|
|
padma_id = models.CharField(max_length=50)
|
|
talk = models.ForeignKey('Talk')
|
|
|
|
def __unicode__(self):
|
|
return self.padma_id
|
|
|
|
class Image(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
file = models.FileField(upload_to='upload/images')
|
|
meeting = models.ForeignKey('Meeting', blank=True, null=True)
|
|
talk = models.ForeignKey('Talk', blank=True, null=True)
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class Document(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = RichTextField(blank=True, null=True)
|
|
file = models.FileField(upload_to='upload/docs', blank=True, null=True)
|
|
meeting = models.ForeignKey('Meeting', blank=True, null=True)
|
|
talk = models.ForeignKey('Talk', blank=True, null=True)
|
|
is_resource = models.BooleanField()
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class Project(models.Model):
|
|
title = models.CharField(max_length=255)
|
|
intro = models.TextField(blank=True, null=True)
|
|
start_date = models.DateField(blank=True, null=True)
|
|
end_date = models.DateField(blank=True, null=True)
|
|
slug = models.SlugField()
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class Signup(models.Model):
|
|
email = models.EmailField()
|
|
|
|
def __unicode__(self):
|
|
return self.email
|