40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from django.db import models
|
|
from tagging.fields import TagField
|
|
|
|
class BestPractice(models.Model):
|
|
title = models.CharField(max_length=512)
|
|
story = models.TextField()
|
|
guideline = models.TextField(blank=True)
|
|
law = models.TextField(blank=True)
|
|
theatre = models.TextField(blank=True, help_text="Spotlight on Theatre text")
|
|
quick_howto = models.TextField(blank=True)
|
|
tags = TagField(blank=True, help_text="Enter as many tags as you like, separated by commas.")
|
|
category = models.ForeignKey("BestPracticeCategory")
|
|
|
|
def __unicode__(self):
|
|
return self.title
|
|
|
|
class BestPracticeCategory(models.Model):
|
|
name = models.CharField(max_length=256)
|
|
description = models.TextField(blank=True)
|
|
|
|
def __unicode__(self):
|
|
return self.name
|
|
|
|
class BestPracticeLink(models.Model):
|
|
url = models.URLField()
|
|
text = models.TextField(blank=True)
|
|
bestpractice = models.ForeignKey(BestPractice)
|
|
|
|
def __unicode__(self):
|
|
return self.url
|
|
|
|
class BestPracticeImage(models.Model):
|
|
image = models.ImageField(upload_to='upload/images/bestpractices/')
|
|
caption = models.CharField(max_length=512, blank=True)
|
|
bestpractice = models.ForeignKey(BestPractice)
|
|
|
|
def __unicode__(self):
|
|
return self.caption
|
|
|