ubuntu下python3.4+django创建网站
2015-01-24 11:29
344 查看
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,)
相关文章推荐
- 手把手教你:Ubuntu14+apache2+django1.7+python2.7下网页/网站部署
- [python网站开发] 一.Django入门知识及创建第一个网站
- Ubuntu14.04+Python3.4+apache2.4+Django1.7站点发布笔记
- 在 Windows Azure 网站上使用 Django、Python 和 MySQL:创建博客应用程序
- 使用Python Django在Ubuntu下搭建数据库型网站
- ubuntu16.04在python3 下创建Django项目并运行的操作方法
- 在 Windows Azure 网站上使用 Django、Python 和 MySQL:创建博客应用程序
- [python网站开发] 一.Django入门知识及创建第一个网站
- ubuntu 创建Django工程出现:Cannot find installed version of python-django or python3-django.
- 在 Windows Azure 网站上使用 Django、Python 和 MySQL:创建博客应用程序
- Python3+django2.0+apache2+ubuntu14部署网站上线的方法
- 在 Windows Azure 网站上使用 Django、Python 和 MySQL:创建博客应用程序
- Ubuntu Server,Python,Django,Apache
- Linux (ubuntu 12.04)下搭建Python Django环境
- (转)在ubuntu下搭建python开发环境(pycharm,postgresql,virtualenv, Django)
- python django 创建数据库和自动化admin
- 在ubuntu下搭建python开发环境(pycharm,postgresql,virtualenv, Django)
- linux下搭建nginx,uwsgi和python的flask和django网站
- ubuntu下python django的安装
- 在ubuntu下搭建python开发环境(pycharm,postgresql,virtualenv, Django)