python django 重新建模
来源:互联网 发布:壁纸桌面软件下载 编辑:程序博客网 时间:2024/05/18 13:06
node2:/app/mysite/blog#cat models.pyfrom django.db import modelsfrom django.contrib import admin# Create your models here.class BlogPost(models.Model): title = models.CharField(max_length = 150) body = models.TextField() timestamp = models.DateTimeField() class Meta: ordering =('-timestamp',)class BlogPostAdmin(admin.ModelAdmin): list_display = ('title','timestamp')admin.site.register(BlogPost,BlogPostAdmin)class Book(models.Model): title=models.CharField(max_length=100) author=models.URLField(max_length=200) length=models.IntegerField()添加了class Book(models.Model): title=models.CharField(max_length=100) author=models.URLField(max_length=200) length=models.IntegerField()python 重新建模:node2:/app/mysite#python manage.py migrateOperations to perform: Apply all migrations: admin, auth, blog, contenttypes, sessionsRunning migrations: No migrations to apply. Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.node2:/app/mysite#python manage.py migrate blogOperations to perform: Apply all migrations: blogRunning migrations: No migrations to apply. Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.node2:/app/mysite#python manage.py makemigrationsMigrations for 'blog': blog/migrations/0002_auto_20171001_1904.py - Create model Book - Change Meta options on blogpostnode2:/app/mysite#python manage.py migrate blogOperations to perform: Apply all migrations: blogRunning migrations: Applying blog.0002_auto_20171001_1904... OKnode2:/app/mysite#mysql> select * from blog_book;Empty set (0.00 sec)mysql> select * from blog_blogpost;+----+-----------+--------------+----------------------------+| id | title | body | timestamp |+----+-----------+--------------+----------------------------+| 1 | 测试 | 1111 | 2017-09-26 02:24:54.000000 || 2 | aabbcc | 112233aabbcc | 2017-09-26 02:27:23.000000 || 3 | ttt | tttttttttt | 2017-09-26 02:30:01.000000 || 4 | 9999 | 999999999 | 2017-09-27 00:17:56.000000 || 5 | xxx | 达到达到 | 2017-09-28 02:21:21.000000 || 6 | www | 呃呃呃 | 2017-09-29 06:58:08.000000 |+----+-----------+--------------+----------------------------+6 rows in set (0.00 sec)
阅读全文
0 0
- python django 重新建模
- django 重新回忆
- Django点滴(五)---建模
- python+django+django环境
- django+python
- python Django
- Python Django
- python django
- [python]django
- django+python
- python django
- Python Django
- python django
- python django
- Python DJango
- python django
- python django
- python 内建模块
- python 处理Excel 常见问题-读取Excel中时间
- 使用 python 的sklearn模块,训练模型时,出现 ValueError: min_samples_split must be at least 2 or in (0, 1], got 1 的
- Dlib格式与Opencv之间的转化
- 仿照火狐浏览器watch函数实现功能
- ES6 对象实现 Iterator 接口
- python django 重新建模
- spring-websocket 配置 websocket发送消息(群发)
- 程序员业余时间修炼指南
- 使用 Annotation将配置资源注入到Bean中
- Android开发知识(八):Android事件处理机制:事件分发、传递、拦截、处理机制的原理分析(中)
- cout和printf输出结果不一样
- java开发常用词汇02
- 用main调试spring
- 设计模式_16:迭代器模式