From 2d7ca5f8c145191d97422ea39e210f7a36204fe3 Mon Sep 17 00:00:00 2001 From: phalt Date: Sat, 21 Mar 2015 14:54:18 +0000 Subject: [PATCH] Reword tutorial to support stuff in database --- en/django_orm/README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/en/django_orm/README.md b/en/django_orm/README.md index 6e83cbaee90..e91b296a150 100644 --- a/en/django_orm/README.md +++ b/en/django_orm/README.md @@ -37,13 +37,13 @@ Oops! An error showed up. It tells us that there is no Post. It's correct -- we This is simple: we import model `Post` from `blog.models`. Let's try displaying all posts again: >>> Post.objects.all() - [] + [, ] -It's an empty list. That seems to be correct, right? We didn't add any posts yet! Let's fix that. +It's a list of the posts we created earlier! We created these posts using the Django admin interface. However, now we want to create new posts using python, so how do we do that? ### Create object -This is how you create a Post object in database: +This is how you create a new Post object in database: >>> Post.objects.create(author=me, title='Sample title', text='Test') @@ -55,20 +55,10 @@ Let's import User model first: What users do we have in our database? Try this: - >>> User.objects.all() - [] - -No users! Let's create a user: - - >>> User.objects.create(username='ola') - - -What users do we now have in our database? Try this: - >>> User.objects.all() [] -Cool! Let's get an instance of the user now: +It's the superuser we created earlier! Let's get an instance of the user now: me = User.objects.get(username='ola')