Skip to content

Commit ac645a7

Browse files
committed
Merge branch 'master' of github.com:DjangoGirls/tutorial
2 parents d58f8b5 + fda4abc commit ac645a7

File tree

52 files changed

+145
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+145
-118
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Django Girls Tutorial
1+
# Django Girls Tutorial
22
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/DjangoGirls/tutorial?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
33

44
> This work is licensed under the Creative Commons Attribution-ShareAlike 4.0

en/deploy/README.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,15 @@ Create a file named `.gitignore` in your `djangogirls` directory with the follow
129129
staticfiles
130130
local_settings.py
131131
db.sqlite3
132+
*.py[co]
132133

133134
and save it. The dot on the beginning of the file name is important! As you can see, we're now telling Heroku to ignore `local_settings.py` and don't download it, so it's only available on your computer (locally).
134135

135-
Next, we’ll create a new git repository and save our changes. Go to your console and run these commands:
136+
Next, we’ll create a new git repository and save our changes.
137+
138+
> __Note__: Check out your current working directory with a `pwd` command before initializing the repository. You should be in the `djangogirls` folder.
139+
140+
Go to your console and run these commands:
136141

137142
$ git init
138143
Initialized empty Git repository in ~/djangogirls/.git/
@@ -141,6 +146,28 @@ Next, we’ll create a new git repository and save our changes. Go to your conso
141146

142147
Initializing the git repository is something we only need to do once per project.
143148

149+
It's a good idea to use a `git status` command before `git add` or whenever you find yourself unsure of what will be done, to prevent any surprises from happening (e.g. wrong files will be added or commited). The `git status` command returns information about any untracked/modifed/staged files, branch status and much more. The output should be similar to:
150+
151+
$ git status
152+
On branch master
153+
154+
Initial commit
155+
156+
Untracked files:
157+
(use "git add <file>..." to include in what will be committed)
158+
159+
.gitignore
160+
Procfile
161+
mysite/__init__.py
162+
mysite/settings.py
163+
mysite/urls.py
164+
mysite/wsgi.py
165+
manage.py
166+
requirements.txt
167+
runtime.txt
168+
169+
nothing added to commit but untracked files present (use "git add" to track)
170+
144171
And finally we save our changes. Go to your console and run these commands:
145172

146173
$ git add -A .

en/django_admin/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Make sure that at least two or three posts (but not all) have the publish date s
3434

3535
![Django admin](images/edit_post3.png)
3636

37-
If you want to know more about Django admin, you should check Django's documentation: https://docs.djangoproject.com/en/1.7/ref/contrib/admin/
37+
If you want to know more about Django admin, you should check Django's documentation: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/
3838

3939
This is probably a good moment to grab a coffee (or tea) or something to eat to re-energise yourself. You created your first Django model - you deserve a little timeout!
4040

en/django_forms/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ We open `blog/urls.py` and add a line:
8282

8383
And the final code will look like this:
8484

85-
from django.conf.urls import patterns, include, url
85+
from django.conf.urls import include, url
8686
from . import views
8787

88-
urlpatterns = patterns('',
88+
urlpatterns = [
8989
url(r'^$', views.post_list),
9090
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail),
9191
url(r'^post/new/$', views.post_new, name='post_new'),
92-
)
92+
]
9393

9494
After refreshing the site, we see an `AttributeError`, since we don't have `post_new` view implemented. Let's add it right now.
9595

@@ -282,7 +282,7 @@ Feel free to change the title or the text and save changes!
282282

283283
Congratulations! Your application is getting more and more complete!
284284

285-
If you need more information about Django forms you should read the documentation: https://docs.djangoproject.com/en/1.7/topics/forms/
285+
If you need more information about Django forms you should read the documentation: https://docs.djangoproject.com/en/1.8/topics/forms/
286286

287287
## One more thing: deploy time!
288288

en/django_installation/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To create a new `virtualenv`, you need to open the console (we told you about th
3131

3232
C:\Users\Name\djangogirls> C:\Python34\python -m venv myvenv
3333

34-
where `C:\Python34\python` is the directory in which you previously installed Python and `myvenv` is the name of your `virtualenv`. You can use any other name, but stick to lowercase and use no spaces. It is also good idea to keep the name short - you'll be referencing it a lot!
34+
where `C:\Python34\python` is the directory in which you previously installed Python and `myvenv` is the name of your `virtualenv`. You can use any other name, but stick to lowercase and use no spaces, accents or special characters. It is also good idea to keep the name short - you'll be referencing it a lot!
3535

3636
### Linux and OS X
3737

@@ -88,16 +88,16 @@ OK, we have all important dependencies in place. We can finally install Django!
8888

8989
## Installing Django
9090

91-
Now that you have your `virtualenv` started, you can install Django using `pip`. In the console, run `pip install django==1.7.7` (note that we use a double equal sign: `==`).
91+
Now that you have your `virtualenv` started, you can install Django using `pip`. In the console, run `pip install django==1.8` (note that we use a double equal sign: `==`).
9292

93-
(myvenv) ~$ pip install django==1.7.7
94-
Downloading/unpacking django==1.7.7
93+
(myvenv) ~$ pip install django==1.8
94+
Downloading/unpacking django==1.8
9595
Installing collected packages: django
9696
Successfully installed django
9797
Cleaning up...
9898

9999
on Windows
100-
> If you get an error when calling pip on Windows platform please check if your project pathname contains spaces (i.e. `C:\Users\User Name\djangogirls`). If it does please consider moving it to another place without spaces (suggestion is: `C:\djangogirls`). After the move please try the above command again.
100+
> If you get an error when calling pip on Windows platform please check if your project pathname contains spaces, accents or special characters (i.e. `C:\Users\User Name\djangogirls`). If it does please consider moving it to another place without spaces, accents or special characters (suggestion is: `C:\djangogirls`). After the move please try the above command again.
101101
102102
on Linux
103103
> If you get an error when calling pip on Ubuntu 12.04 please run `python -m pip install -U --force-reinstall pip` to fix the pip installation in the virtualenv.

en/django_models/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Now we define properties we were talking about: `title`, `text`, `created_date`,
137137
- `models.DateTimeField` - this is a date and time.
138138
- `models.ForeignKey` - this is a link to another model.
139139

140-
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.7/ref/models/fields/#field-types).
140+
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).
141141

142142
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`).
143143

en/django_urls/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ Every page on the Internet needs its own URL. This way your application knows wh
1414

1515
Let's open up the `mysite/urls.py` file and see what it looks like:
1616

17-
from django.conf.urls import patterns, include, url
17+
from django.conf.urls import include, url
1818
from django.contrib import admin
1919

20-
urlpatterns = patterns('',
20+
urlpatterns = [
2121
# Examples:
2222
# url(r'^$', 'mysite.views.home', name='home'),
2323
# url(r'^blog/', include('blog.urls')),
2424

2525
url(r'^admin/', include(admin.site.urls)),
26-
)
26+
]
2727

2828
As you can see, Django already put something here for us.
2929

@@ -52,30 +52,30 @@ Go ahead, delete the commented lines (lines starting with `#`) and add a line th
5252

5353
Your `mysite/urls.py` file should now look like this:
5454

55-
from django.conf.urls import patterns, include, url
55+
from django.conf.urls import include, url
5656
from django.contrib import admin
5757

58-
urlpatterns = patterns('',
58+
urlpatterns = [
5959
url(r'^admin/', include(admin.site.urls)),
6060
url(r'', include('blog.urls')),
61-
)
61+
]
6262

6363
Django will now redirect everything that comes into 'http://127.0.0.1:8000/' to `blog.urls` and look for further instructions there.
6464

6565
## blog.urls
6666

6767
Create a new `blog/urls.py` empty file. All right! Add these two first lines:
6868

69-
from django.conf.urls import patterns, include, url
69+
from django.conf.urls import include, url
7070
from . import views
7171

7272
Here we're just importing Django's methods and all of our `views` from `blog` application (we don't have any yet, but we will get to that in a minute!)
7373

7474
After that, we can add our first URL pattern:
7575

76-
urlpatterns = patterns('',
76+
urlpatterns = [
7777
url(r'^$', views.post_list),
78-
)
78+
]
7979

8080
As you can see, we're now assigning a `view` called `post_list` to `^$` URL. But what does `^$` mean? It's a regex magic :) Let's break it down:
8181
- `^` in regex means "the beginning"; from this sign we can start looking for our pattern
@@ -91,4 +91,4 @@ There is no "It works" anymore, huh? Don't worry, it's just an error page, nothi
9191

9292
You can read that there is __no attribute 'post_list'__. Is *post_list* reminding you of anything? This is how we called our view! This means that everything is in place, we just didn't create our *view* yet. No worries, we will get there.
9393

94-
> If you want to know more about Django URLconfs, look at the official documentation: https://docs.djangoproject.com/en/1.7/topics/http/urls/
94+
> If you want to know more about Django URLconfs, look at the official documentation: https://docs.djangoproject.com/en/1.8/topics/http/urls/

en/django_views/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ Another error! Read what's going on now:
3030

3131
This one is easy: *TemplateDoesNotExist*. Let's fix this bug and create a template in the next chapter!
3232

33-
> Learn more about Django views by reading the official documentation: https://docs.djangoproject.com/en/1.7/topics/http/views/
33+
> Learn more about Django views by reading the official documentation: https://docs.djangoproject.com/en/1.8/topics/http/views/

en/dynamic_data_in_templates/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ So finally our `blog/views.py` file should look like this:
5858

5959
That's it! Time to go back to our template and display this QuerySet!
6060

61-
If you want to read a little bit more about QuerySets in Django you should look here: https://docs.djangoproject.com/en/1.7/ref/models/querysets/
61+
If you want to read a little bit more about QuerySets in Django you should look here: https://docs.djangoproject.com/en/1.8/ref/models/querysets/
6262

6363

6464

en/extend_your_application/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ Let's create a URL in `urls.py` for our `post_detail` *view*!
4444

4545
We want to create a URL to point Django to a *view* called `post_detail`, that will show an entire blog post. Add the line `url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail),` to the `blog/urls.py` file. It should look like this:
4646

47-
from django.conf.urls import patterns, include, url
47+
from django.conf.urls import include, url
4848
from . import views
4949

50-
urlpatterns = patterns('',
50+
urlpatterns = [
5151
url(r'^$', views.post_list),
5252
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail),
53-
)
53+
]
5454

5555
That one looks scary, but no worries - we will explain it for you:
5656
- it starts with `^` again -- "the beginning"

en/html/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A Django template's format is described in a language called HTML (that's the HT
1010

1111
HTML is a simple code that is interpreted by your web browser - such as Chrome, Firefox or Safari - to display a webpage for the user.
1212

13-
HTML stands for "HyperText Markup Language." __HyperText__ means it's a type of text that supports hyperlinks between pages. __Markup__ means we have taken a document and marked it up with code to tell something (in this case, a browser) how to interpret the page. HTML code is built with __tags__, each one starting with `<` and ending with `>`. These tags markup __elements__.
13+
HTML stands for "HyperText Markup Language". __HyperText__ means it's a type of text that supports hyperlinks between pages. __Markup__ means we have taken a document and marked it up with code to tell something (in this case, a browser) how to interpret the page. HTML code is built with __tags__, each one starting with `<` and ending with `>`. These tags markup __elements__.
1414

1515
## Your first template!
1616

@@ -28,7 +28,7 @@ And now create a `post_list.html` file (just leave it blank for now) inside the
2828

2929
See how your website looks now: http://127.0.0.1:8000/
3030

31-
> If you still have an error `TemplateDoesNotExists`, try to restart your server. Go into command line, stop the reserver by pressing Ctrl+C (Control and C buttons together) and start it again by running a `python manage.py runserver` command.
31+
> If you still have an error `TemplateDoesNotExists`, try to restart your server. Go into command line, stop the server by pressing Ctrl+C (Control and C buttons together) and start it again by running a `python manage.py runserver` command.
3232
3333
![Figure 11.1](images/step1.png)
3434

@@ -125,7 +125,7 @@ Here's an example of a full template:
125125

126126
We've created three `div` sections here.
127127

128-
- The first `div` element contains the title of our blogpost - it's a heading and a link
128+
- The first `div` element contains the title of our blog - it's a heading and a link
129129
- Another two `div` elements contain our blogposts with a published date, `h2` with a post title that is clickable and two `p`s (paragraph) of text, one for the date and one for our blogpost.
130130

131131
It gives us this effect:
@@ -134,7 +134,7 @@ It gives us this effect:
134134

135135
Yaaay! But so far, our template only ever displays exactly __the same information__ - whereas earlier we were talking about templates as allowing us to display __different__ information in the __same format__.
136136

137-
What we want really want to do is display real posts added in our Django admin - and that's where we're going next.
137+
What we really want to do is display real posts added in our Django admin - and that's where we're going next.
138138

139139
## One more thing
140140

en/whats_next/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ After that make sure to:
1515
Yes! First, go ahead and try our other book, called [Django Girls Tutorial: Extensions](http://djangogirls.gitbooks.io/django-girls-tutorial-extensions/).
1616

1717
Later on, you can try recources listed below. They're all very recommended!
18-
- [Django's official tutorial](https://docs.djangoproject.com/en/1.7/intro/tutorial01/)
18+
- [Django's official tutorial](https://docs.djangoproject.com/en/1.8/intro/tutorial01/)
1919
- [New Coder tutorials](http://newcoder.io/tutorials/)
2020
- [Code Academy Python course](http://www.codecademy.com/en/tracks/python)
2121
- [Code Academy HTML & CSS course](http://www.codecademy.com/tracks/web)

es/deploy/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Crea un fichero llamado `.gitignore` en tu directorio `djangogirls` con el sigui
140140
staticfiles
141141
local_settings.py
142142
db.sqlite3
143-
143+
*.py[co]
144144

145145
y guarda los cambios. El punto al principio del nombre del fichero es importante! Como puedes ver, ahora le estamos diciendo a Heroku que ignore el fichero `local_settings.py` y no lo descargue, para que esté disponible solamente en tu ordenador (en local).
146146

@@ -234,4 +234,4 @@ El error que veías era debido a que cuando desplegamos en Heroku creamos una nu
234234
$ heroku run python manage.py createsuperuser
235235

236236

237-
Ahora deberías poder acceder a tu sitio web desde el navegador! Felicidades :)!
237+
Ahora deberías poder acceder a tu sitio web desde el navegador! Felicidades :)!

es/django_admin/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ Asegúrate que al menos dos o tres entradas (pero no todas) tengan la fecha de p
4747

4848
[3]: images/edit_post3.png
4949

50-
Sí quieres sabes más sobre Django admin, deberías revisar la documentación de Django: https://docs.djangoproject.com/en/1.7/ref/contrib/admin/
50+
Sí quieres sabes más sobre Django admin, deberías revisar la documentación de Django: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/
5151

52-
Probablemente sea un buen momento para tomar un café (o té) y comer algo dulce. Haz creado tu primer modelo Django - te mereces un regalito!
52+
Probablemente sea un buen momento para tomar un café (o té) y comer algo dulce. Haz creado tu primer modelo Django - te mereces un regalito!

es/django_forms/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ Abrimos el `blog/urls.py` y añadimos una línea:
8888

8989
Y el código final tendrá este aspecto:
9090

91-
from django.conf.urls import patterns, include, url
91+
from django.conf.urls import include, url
9292
from . import views
9393

94-
urlpatterns = patterns('',
94+
urlpatterns = [
9595
url(r'^$', views.post_list),
9696
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail),
9797
url(r'^post/new/$', views.post_new, name='post_new'),
98-
)
98+
]
9999

100100

101101
Después de actualizar el sitio, veremos un `AttributeError`, puesto que no tenemos la vista `post_new` implementado. Vamos a añadir ahora.
@@ -315,7 +315,7 @@ Al dar click ahí, debes ver el formulario con nuestro post del blog:
315315

316316
¡Felicitaciones.Tu aplicación está cada vez más completa!
317317

318-
Si necesitas más información sobre los formularios de Django, debes leer la documentación: https://docs.djangoproject.com/en/1.7/topics/forms/
318+
Si necesitas más información sobre los formularios de Django, debes leer la documentación: https://docs.djangoproject.com/en/1.8/topics/forms/
319319

320320
## Una cosa más: ¡Tiempo de implementación!
321321

@@ -331,4 +331,4 @@ Sería bueno ver si tu sitio sigue funcionando en Heroku, ¿no? Intentemos imple
331331
$ git push heroku master
332332

333333

334-
¡Y eso debería ser todo! Felicidades :)
334+
¡Y eso debería ser todo! Felicidades :)

es/django_installation/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ Tenemos todas las dependencias importantes en su lugar. ¡Finalmente podemos ins
9393

9494
## Instalar Django
9595

96-
Ahora que tienes tu `virtualenv` iniciado, puedes instalar Django usando `pip`. En la consola, ejecuta `pip install django == 1.7.1` (fíjate que utilizamos un doble signo igual): `==`).
96+
Ahora que tienes tu `virtualenv` iniciado, puedes instalar Django usando `pip`. En la consola, ejecuta `pip install django == 1.8` (fíjate que utilizamos un doble signo igual): `==`).
9797

98-
(myvenv) ~$ pip install django==1.7.1
99-
Downloading/unpacking django==1.7.1
98+
(myvenv) ~$ pip install django==1.8
99+
Downloading/unpacking django==1.8
100100
Installing collected packages: django
101101
Successfully installed django
102102
Cleaning up...
@@ -110,4 +110,4 @@ en Linux
110110

111111
> Si obtienes un error al correr pip en Ubuntu 12.04 ejecuta `python -m pip install- U - force-resintall pip` para arreglar la instalación de pip en el virtualenv.
112112
113-
¡Eso es todo. Ahora estás listo (por fin) para crear una aplicación Django! Pero para hacer eso, necesitas un buen programa en el cual escribir código...
113+
¡Eso es todo. Ahora estás listo (por fin) para crear una aplicación Django! Pero para hacer eso, necesitas un buen programa en el cual escribir código...

0 commit comments

Comments
 (0)