Skip to content

Commit 8cfd0be

Browse files
committed
Cleanup some wording and example output based on running through
first part of tutorial with Python 3.4.3 and Django 1.8
1 parent 186a5a4 commit 8cfd0be

File tree

6 files changed

+50
-37
lines changed

6 files changed

+50
-37
lines changed

en/code_editor/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Atom is an extremely new code editor created by [GitHub](http://github.com/). It
2626

2727
You might be wondering why we are installing this special code editor software, rather than using something like Word or Notepad.
2828

29-
The first is that code needs to be **plain text**, and the problem with programs like Word and Textedit is that they don't actually produce plain text, they produce rich text (with fonts and formatting), using custom formats like rtf.
29+
The first is that code needs to be **plain text**, and the problem with programs like Word and Textedit is that they don't actually produce plain text, they produce rich text (with fonts and formatting), using custom formats like [RTF (Rich Text Format)](https://en.wikipedia.org/wiki/Rich_Text_Format).
3030

31-
The second reason is that code editors are specialised in editing code, so they can provide helpful features, like highlighting code with colour according to its meaning, or automatically closing quotes for you.
31+
The second reason is that code editors are specialised for editing code, so they can provide helpful features like highlighting code with colour according to its meaning, or automatically closing quotes for you.
3232

3333
We'll see all this in action later. Soon, you'll come to think of your trusty old code editor as one of your favourite tools :)
3434

en/django/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# What is Django?
22

3-
Django (_/ˈdʒæŋɡoʊ/ jang-goh_) is a free and open source web application framework, written in Python. It's a web framework - a set of components that helps you to develop websites faster and easier.
3+
Django (_/ˈdʒæŋɡoʊ/ jang-goh_) is a free and open source web application framework, written in Python. A web framework is a set of components that helps you to develop websites faster and easier.
44

5-
You see, when you're building a website, you always need a similar set of components: a way to handle user authentication (signing up, signing in, signing out), a management panel for your website, forms, a way to upload files, etc.
5+
When you're building a website, you always need a similar set of components: a way to handle user authentication (signing up, signing in, signing out), a management panel for your website, forms, a way to upload files, etc.
66

77
Luckily for you other people long ago noticed that web developers face similar problems when building a new site, so they teamed up and created frameworks (Django is one of them) that give you ready-made components you can use.
88

en/django_models/README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ There is a concept in programming called `Object-oriented programming`. The idea
88

99
So what is an object? It is a collection of properties and actions. It sounds weird, but we will give you an example.
1010

11-
If we want to model a cat we will create an object `Cat` that has some properties, i.e. `color`, `age`, `mood` (i.e. good, bad, sleepy ;)), `owner` (that is a `Person` object or maybe, in case of a stray cat, this property is empty).
11+
If we want to model a cat we will create an object `Cat` that has some properties such as: `color`, `age`, `mood` (i.e. good, bad, sleepy ;)), and `owner` (that is a `Person` object or maybe, in case of a stray cat, this property is empty).
1212

13-
And then the `Cat` has some actions: `purr`, `scratch` or `feed` (in which we will give the cat some `CatFood`, which could be a separate object with properties, i.e. `taste`).
13+
Then the `Cat` has some actions: `purr`, `scratch`, or `feed` (in which we will give the cat some `CatFood`, which could be a separate object with properties, i.e. `taste`).
1414

1515
Cat
1616
--------
@@ -45,7 +45,7 @@ Well, for sure our blog post needs some text with its content and a title, right
4545

4646
What kind of things could be done with a blog post? It would be nice to have some `method` that publishes the post, right?
4747

48-
So we will need `publish` method.
48+
So we will need a `publish` method.
4949

5050
Since we already know what we want to achieve, we can start modeling it in Django!
5151

@@ -131,39 +131,40 @@ All lines starting with `from` or `import` are lines that add some bits from oth
131131
`class Post(models.Model):` - this line defines our model (it is an `object`).
132132

133133
- `class` is a special keyword that indicates that we are defining an object.
134-
- `Post` is the name of our model, we can give it a different name (but we must avoid special characters and whitespaces). Always start a class name with an uppercase letter.
134+
- `Post` is the name of our model. We can give it a different name (but we must avoid special characters and whitespaces). Always start a class name with an uppercase letter.
135135
- `models.Model` means that the Post is a Django Model, so Django knows that it should be saved in the database.
136136

137-
Now we define properties we were talking about: `title`, `text`, `created_date`, `published_date` and `author`. To do that we need to define a type of field (is it text? A number? A date? A relation to another object, i.e. a User?).
137+
Now we define the properties we were talking about: `title`, `text`, `created_date`, `published_date` and `author`. To do that we need to define a type of each field (Is it text? A number? A date? A relation to another object, i.e. a User?).
138138

139139
- `models.CharField` - this is how you define text with a limited number of characters.
140-
- `models.TextField` - this is for long texts without a limit. It will be ideal for a blog post content, right?
140+
- `models.TextField` - this is for long text without a limit. Sounds ideal for blog post content, right?
141141
- `models.DateTimeField` - this is a date and time.
142142
- `models.ForeignKey` - this is a link to another model.
143143

144-
We will not explain every bit of code here, since it would take too much time. You should take a look at Django's documentation, if you want to know more about Model fields and how to define things other than those described above (https://docs.djangoproject.com/en/1.8/ref/models/fields/#field-types).
144+
We will not explain every bit of code here, since it would take too much time. You should take a look at Django's documentation if you want to know more about Model fields and how to define things other than those described above (https://docs.djangoproject.com/en/1.8/ref/models/fields/#field-types).
145145

146-
What about `def publish(self):`? It is exactly our `publish` method we were talking about before. `def` means that this is a function/method. `publish` is the name of the method. You can change it, if you want. The rule is that we use lowercase and underscores instead of whitespaces (i.e. if you want to have a method that calculates average price you could call it `calculate_average_price`).
146+
What about `def publish(self):`? It is exactly our `publish` method we were talking about before. `def` means that this is a function/method and `publish` is the name of the method. You can change the name of the method, if you want. The naming rule is that we use lowercase and underscores instead of whitespaces (i.e. if you want to have a method that calculates average price you could call it `calculate_average_price`).
147147

148148
Methods very often `return` something. There is an example of that in the `__str__` method. In this scenario, when we call `__str__()` we will get a text (**string**) with a Post title.
149149

150150
If something is still not clear about models, feel free to ask your coach! We know it is very complicated, especially when you learn what objects and functions are at the same time. But hopefully it looks slightly less magic for you now!
151151

152152
### Create tables for models in your database
153153

154-
The last step here is to add our new model to our database. First we have to make Django know that we have some changes in our model (we have just created it), type `python manage.py makemigrations blog`. It will look like this:
154+
The last step here is to add our new model to our database. First we have to make Django know that we have some changes in our model (we have just created it!). Type `python manage.py makemigrations blog`. It will look like this:
155155

156156
(myvenv) ~/djangogirls$ python manage.py makemigrations blog
157157
Migrations for 'blog':
158158
0001_initial.py:
159159
- Create model Post
160160

161-
Django prepared for us a migration file that we have to apply now to our database, type `python manage.py migrate blog`, the output should be:
161+
Django prepared for us a migration file that we have to apply now to our database. Type `python manage.py migrate blog` and the output should be:
162162

163163
(myvenv) ~/djangogirls$ python manage.py migrate blog
164164
Operations to perform:
165165
Apply all migrations: blog
166166
Running migrations:
167+
Rendering model states... DONE
167168
Applying blog.0001_initial... OK
168169

169-
Hurray! Our Post model is now in our database, it would be nice to see it, right? Jump to the next chapter to see what your Post looks like!
170+
Hurray! Our Post model is now in our database! It would be nice to see it, right? Jump to the next chapter to see what your Post looks like!

en/django_start_project/README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ is copyrighted by Markus Zapke-Gründemann et al.
99

1010
We're going to create a simple blog!
1111

12-
The first step towards creating it is to start a new Django project. Basically, this means that we'll run some scripts provided by Django that will create the skeleton of a Django project for us: a bunch of directories and files that we will later use.
12+
The first step is to start a new Django project. Basically, this means that we'll run some scripts provided by Django that will create the skeleton of a Django project for us: a bunch of directories and files that we will later use.
1313

1414
The names of some files and directories are very important for Django. You should not rename the files that we are about to create. Moving them to a different place is also not a good idea. Django needs to maintain a certain structure in order to be able to find important things.
1515

16-
> Remember to run everything in the virtualenv. If you don't see a prefix `(myvenv)` in your console you need to activate your virtualenv. We explained how to do that in the __Django installation__ chapter in the __Working with virtualenv__ part. You can do that by typing the following command: `myvenv\Scripts\activate` on Windows or
16+
> Remember to run everything in the virtualenv. If you don't see a prefix `(myvenv)` in your console you need to activate your virtualenv. We explained how to do that in the __Django installation__ chapter in the __Working with virtualenv__ part. You can do that by typing the following command: `myvenv\Scripts\activate` on Windows or
1717
`myvenv/bin/activate` on Mac OS / Linux.
1818

1919
In your MacOS or Linux console you should run the following command; **don't forget to add the period (or dot) `.` at the end**:
@@ -26,7 +26,7 @@ On Windows; **don't forget to add the period (or dot) `.` at the end**:
2626

2727
> The period `.` is crucial because it tells the script to install Django in your current directory (for which the period `.` is a short-hand reference)
2828
29-
> **Note** When typing the commands above, remember that you only type the part which starts `django-admin` or `django-admin.py`.
29+
> **Note** When typing the commands above, remember that you only type the part which starts `django-admin` or `django-admin.py`.
3030
The`(myvenv) ~/djangogirls$` and `(myvenv) C:\Users\Name\djangogirls>` parts shown here are just examples
3131
of the prompt that will be inviting your input on your command line.
3232

@@ -69,7 +69,7 @@ We'll also need to add a path for static files (we'll find out all about static
6969

7070
```python
7171
STATIC_URL = '/static/'
72-
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
72+
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
7373
```
7474

7575

@@ -92,11 +92,23 @@ To create a database for our blog, let's run the following in the console: `pyth
9292

9393
(myvenv) ~/djangogirls$ python manage.py migrate
9494
Operations to perform:
95-
Apply all migrations: admin, contenttypes, auth, sessions
95+
Synchronize unmigrated apps: messages, staticfiles
96+
Apply all migrations: contenttypes, sessions, admin, auth
97+
Synchronizing apps without migrations:
98+
Creating tables...
99+
Running deferred SQL...
100+
Installing custom SQL...
96101
Running migrations:
102+
Rendering model states... DONE
97103
Applying contenttypes.0001_initial... OK
98104
Applying auth.0001_initial... OK
99105
Applying admin.0001_initial... OK
106+
Applying contenttypes.0002_remove_content_type_name... OK
107+
Applying auth.0002_alter_permission_name_max_length... OK
108+
Applying auth.0003_alter_user_email_max_length... OK
109+
Applying auth.0004_alter_user_username_opts... OK
110+
Applying auth.0005_alter_user_last_login_null... OK
111+
Applying auth.0006_require_contenttypes_0002... OK
100112
Applying sessions.0001_initial... OK
101113

102114
And we're done! Time to start the web server and see if our website is working!

en/intro_to_command_line/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Windows:
144144

145145
> mkdir djangogirls
146146

147-
This little command will create a folder with the name `djangogirls` on your desktop. You can check if it's there just by looking on your Desktop or by running a `ls`/`dir` command! Try it :)
147+
This little command will create a folder with the name `djangogirls` on your desktop. You can check if it's there just by looking on your Desktop or by running a `ls` or `dir` command! Try it :)
148148

149149
> PRO tip: If you don't want to type the same commands over and over, try pressing the `up arrow` and `down arrow` on your keyboard to cycle through recently used commands.
150150

0 commit comments

Comments
 (0)