Source

HH-Courses / models.py

Full commit
from django.db import models
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager

class Courses(models.Model):
    title = models.charfield(max_length=100,unique=True)
    slug = models.SlugField('Course URL', max_length=50,unique=True)
    createdate = models.DateTimeField(auto_now_add=True,null=True)
    updatedate = models.DateTimeField(auto_now=True)
    is_published = models.BooleanField(
		"Published", default=False, help_text="Publish this Course?"
	)
    sites = models.ManyToManyField(Site)
    
    @models.permalink
    def get_absolute_url(self):
	return ('courses.views.course_detail', None, { 'slug': self.slug })
    def __unicode__(self):
	return self.title
    
class Lessons(models.Model):
    title = models.Charfield(max_length=150,unique=True)
    content = models.TextField()
    slug = models.SlugField('Lesson URL', max_length=50,unique=True)
    createdate = models.DateTimeField(auto_now_add=True,null=True)
    updatedate = models.DateTimeField(auto_now=True)
    is_published = models.BooleanField(
		"Published", default=False, help_text="Publish this Lesson?"
	)
    @models.permalink
    def get_absolute_url(self):
            return ('courses.views.lesson_detail', None, { 'slug': self.slug })
            
    def __unicode__(self):
            return self.title