Skip to content

Instantly share code, notes, and snippets.

@wenbert
Created February 21, 2011 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wenbert/836705 to your computer and use it in GitHub Desktop.
Save wenbert/836705 to your computer and use it in GitHub Desktop.
from django.db import models
from datetime import datetime
from django.contrib.auth.models import Group, User
class Category(models.Model):
"""
class Car(models.Model):
company_that_makes_it = models.ForeignKey(Manufacturer)
# ...
"""
name = models.CharField(max_length=120)
group = models.ForeignKey(Group)
def __unicode__(self):
return self.name
class Post(models.Model):
title = models.CharField(max_length=250)
slug = models.SlugField(max_length=250, unique=True)
body = models.TextField()
published = models.DateTimeField(default=datetime.now)
categories = models.ManyToManyField(Category)
def __unicode__(self):
return self.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment