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,)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值