Comments (5)
Prompt:
(tddd)alain@alain-thinkpadw530:~/tddd/myblog$ python manage.py convert_to_south blog
Creating migrations directory at '/home/alain/tddd/myblog/blog/migrations'...
Creating __init__.py in '/home/alain/tddd/myblog/blog/migrations'...
+ Added model blog.Entry
+ Added model blog.Comment
Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate blog
- Soft matched migration 0001 to 0001_initial.
Running migrations for blog:
- Migrating forwards to 0001_initial.
> blog:0001_initial
(faked)
App 'blog' converted. Note that South assumed the application's models matched the database
(i.e. you haven't changed it since last syncdb); if you have, you should delete the blog/migrations
directory, revert models.py so it matches the database, and try again.
(tddd)alain@alain-thinkpadw530:~/tddd/myblog$ python manage.py migrate --list
blog
(*) 0001_initial
(tddd)alain@alain-thinkpadw530:~/tddd/myblog$ python manage.py schemamigration --auto blog
Nothing seems to have changed.
(tddd)alain@alain-thinkpadw530:~/tddd/myblog$ python manage.py schemamigration --auto blog
? The field 'Entry.slug' does not have a default specified, yet is NOT NULL.
? Since you are adding this field, you MUST specify a default
? value to use for existing rows. Would you like to:
? 1. Quit now, and add a default to the field in models.py
? 2. Specify a one-off value to use for existing columns now
? Please select a choice:
from test-driven-django-development.
We should select option 2 and then use an empty string for a default.
from test-driven-django-development.
We might want to note that to add slugs to existing entries (if this was a live blog with existing entries) we could make a South data migration. We should link to data migrations in the documentation.
from test-driven-django-development.
>>> ""
+ Added field slug on blog.Entry
Created 0002_auto__add_field_entry_slug.py. You can now apply this migration with: ./manage.py migrate blog
(tddd)alain@alain-thinkpadw530:~/tddd/myblog$
from test-driven-django-development.
In the interest of keeping the migrations portion brief, I added a default to the slug
field to avoid the prompt all together in #139.
from test-driven-django-development.
Related Issues (20)
- Add a Congratulations Section!!! HOT 1
- 03-views Add reminder about how to restart server
- Suggest Python 2.7.x only... HOT 4
- Testing documentation against Django 1.7 HOT 1
- Change Image re. python version HOT 1
- Change image re. 'python manage.py syncdb' HOT 1
- New updates to section, Python Package Requirements File HOT 1
- Section: Models, Creating an App HOT 1
- Create another tree-structure under the "!Note" section HOT 2
- Under section, Creating a model
- Changes Under section: Creating a model HOT 5
- Under section, Creating entries from the admin site HOT 1
- Getting Started - use pip3 for installing Django HOT 6
- Question: 11 tests vs 10 tests in Blog Entry Detail HOT 1
- In section: Displaying the comment form
- In Section: Make it work of Custom Template Tags HOT 1
- In Section: Making it a bit more robust
- In Section: Displaying the comment form
- Add `on_delete` to ForeignKeys
- Subtle use of Messiaen referenced in documentation causes double take in musical Pythonistas.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from test-driven-django-development.