You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/django_admin/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Make sure that at least two or three posts (but not all) have the publish date s
34
34
35
35

36
36
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/
38
38
39
39
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!
Copy file name to clipboardExpand all lines: en/django_installation/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,10 +88,10 @@ OK, we have all important dependencies in place. We can finally install Django!
88
88
89
89
## Installing Django
90
90
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: `==`).
Copy file name to clipboardExpand all lines: en/django_models/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ Now we define properties we were talking about: `title`, `text`, `created_date`,
137
137
-`models.DateTimeField` - this is a date and time.
138
138
-`models.ForeignKey` - this is a link to another model.
139
139
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).
141
141
142
142
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`).
Copy file name to clipboardExpand all lines: en/django_urls/README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,16 +14,16 @@ Every page on the Internet needs its own URL. This way your application knows wh
14
14
15
15
Let's open up the `mysite/urls.py` file and see what it looks like:
16
16
17
-
from django.conf.urls import patterns, include, url
17
+
from django.conf.urls import include, url
18
18
from django.contrib import admin
19
19
20
-
urlpatterns = patterns('',
20
+
urlpatterns = [
21
21
# Examples:
22
22
# url(r'^$', 'mysite.views.home', name='home'),
23
23
# url(r'^blog/', include('blog.urls')),
24
24
25
25
url(r'^admin/', include(admin.site.urls)),
26
-
)
26
+
]
27
27
28
28
As you can see, Django already put something here for us.
29
29
@@ -52,30 +52,30 @@ Go ahead, delete the commented lines (lines starting with `#`) and add a line th
52
52
53
53
Your `mysite/urls.py` file should now look like this:
54
54
55
-
from django.conf.urls import patterns, include, url
55
+
from django.conf.urls import include, url
56
56
from django.contrib import admin
57
57
58
-
urlpatterns = patterns('',
58
+
urlpatterns = [
59
59
url(r'^admin/', include(admin.site.urls)),
60
60
url(r'', include('blog.urls')),
61
-
)
61
+
]
62
62
63
63
Django will now redirect everything that comes into 'http://127.0.0.1:8000/' to `blog.urls` and look for further instructions there.
64
64
65
65
## blog.urls
66
66
67
67
Create a new `blog/urls.py` empty file. All right! Add these two first lines:
68
68
69
-
from django.conf.urls import patterns, include, url
69
+
from django.conf.urls import include, url
70
70
from . import views
71
71
72
72
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!)
73
73
74
74
After that, we can add our first URL pattern:
75
75
76
-
urlpatterns = patterns('',
76
+
urlpatterns = [
77
77
url(r'^$', views.post_list),
78
-
)
78
+
]
79
79
80
80
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:
81
81
-`^` 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
91
91
92
92
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.
93
93
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/
Copy file name to clipboardExpand all lines: en/extend_your_application/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,13 +44,13 @@ Let's create a URL in `urls.py` for our `post_detail` *view*!
44
44
45
45
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:
46
46
47
-
from django.conf.urls import patterns, include, url
Copy file name to clipboardExpand all lines: en/whats_next/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ After that make sure to:
15
15
Yes! First, go ahead and try our other book, called [Django Girls Tutorial: Extensions](http://djangogirls.gitbooks.io/django-girls-tutorial-extensions/).
16
16
17
17
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/)
0 commit comments