ubuntu下python3.4+django创建网站

from todo.models import *
from django.contrib import admin

import datetime

# Create your models here.
class List(models.Model):
        name = models.CharField(max_length = 60)
        slug = models.SlugField(max_length = 60,editable = False)
        #group  =models.ForeignKey(Group)

        def __unicode__(self):
                return self.name

        class Meta:
                ordering = ["name"]
                verbose_name_plural ="Lists"

        #Prevents (at the db level) creation of two lists with the same name in the same group
class Item(models.Model):
        title = models.CharField(max_length = 150)
        list = models.ForeignKey(List)
        created_date = models.DateField(auto_now = True,auto_now_add = True)
        due_date = models.DateField(blank = True,null = True)
        completed = models.BooleanField()
        completed_date = models.DateField(blank =True,null = True)
        #creted_by = models.ForeignKey(User,related_name = 'todo_created_by')
        #assigned_to = models.ForeignKey(User,related_name = 'todo_assigned_to')
        note = models.TextField(blank = True,null = True)
        priority = models.PositiveIntegerField(max_length = 5)

        def __unicode__(self):
                return self.title
        class Meta:
                ordering = ["priority"]


class Comment(models.Model):
        """Not using Django's build-in comment because we wang=t to be able to save a comment and change task details at the same time ,Roling our own since it's easy ."""
       #author = models.ForeignKey(User)
        task = models.ForeignKey(Item)
        date = models.DateTimeField(default = datetime.datetime.now)
        body = models.TextField(blank =True)

        def __unicode__(self):
                return '%s-%s' %(self.author,self.date,)

你可能感兴趣的:(ubuntu下python3.4+django创建网站)