Created
February 21, 2011 05:48
-
-
Save wenbert/836705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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