My favorites | Sign in
Project Home Wiki Issues Source
Search
for
ExampleModels  
Example models.py
Updated Oct 8, 2007 by paul.jos...@gmail.com
from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date_published')

    class Admin:
        pass

    def __unicode__(self):
        return "<Poll '%s'>" % self.question

class Tag(models.Model):
    name = models.CharField(max_length=200)

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    tags = models.ManyToManyField(Tag)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()

    class Admin:
        pass

    def __unicode__(self):
        return "<Choice '%s'>" % self.choice

Sign in to add a comment
Powered by Google Project Hosting