Skip to content

Commit d8ba815

Browse files
MattBlack85olasitarska
authored andcommitted
Upgrade to Django 1.7
1 parent 72f2143 commit d8ba815

File tree

9 files changed

+52
-52
lines changed

9 files changed

+52
-52
lines changed

django_admin/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ You will see a login page like this:
1919

2020
![Login page](images/login_page2.png)
2121

22-
You should use the username and password you chose when you were creating a database (in the __Starting Django project__ chapter). After logging in, you should see the Django admin dashboard.
22+
In order to log in you need to create a *superuser* - a user which has control over everything on the site. Go back to you command-line and type `python manage.py createsuperuser`, press enter and type your username (lowercase, no spaces), email address and password when you're asked for them. The output should look like this (where username and email should be your own ones):
23+
24+
(myvenv) ~/djangogirls$ python manage.py createsuperuser
25+
Username: admin
26+
Email address: [email protected]
27+
Password:
28+
Password (again):
29+
Superuser created successfully.
30+
31+
Return to your browser and log in with the superuser's credentials you chose, you should see the Django admin dashboard.
2332

2433
![Django admin](images/django_admin3.png)
2534

@@ -29,7 +38,7 @@ Make sure that at least two or three posts (but not all) have the publish date s
2938

3039
![Django admin](images/edit_post3.png)
3140

32-
If you want to know more about Django admin, you should check Django's documentation: https://docs.djangoproject.com/en/1.6/ref/contrib/admin/
41+
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/
3342

3443
It is probably a good moment to grab a coffee (or tea) and eat something sweet. You created your first Django model - you deserve a little treat!
3544

django_forms/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Feel free to change the title or the text and save changes!
284284

285285
Congratulations! Your application is getting more and more complete!
286286

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

289289
## One more thing: deploy time!
290290

django_installation/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ 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.6.6` (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.7` (note that we use a double equal sign: `==`).
9292

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

django_models/README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ You will notice that a new `blog` directory is created and it contains a number
7373
| wsgi.py
7474
├── manage.py
7575
└── blog
76-
__init__.py
77-
admin.py
78-
models.py
79-
tests.py
80-
views.py
76+
├── migrations
77+
| __init__.py
78+
├── __init__.py
79+
├── admin.py
80+
├── models.py
81+
├── tests.py
82+
└── views.py
8183

8284
After creating an application we also need to tell Django that it should use it. We do that in the file `mysite/settings.py`. We need to find `INSTALLED_APPS` and add a line containing `'blog',` just above `)`. So the final product should look like this:
8385

@@ -134,7 +136,7 @@ Now we define properties we were talking about: `title`, `text`, `created_date`,
134136
- `models.DateTimeField` - this is a date and time.
135137
- `models.ForeignKey` - this is a link to another model.
136138

137-
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.6/ref/models/fields/#field-types).
139+
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).
138140

139141
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`).
140142

@@ -144,13 +146,19 @@ If something is still not clear about models, feel free to ask your coach! We kn
144146

145147
### Create tables for models in your database
146148

147-
The last step here is to add our new model to our database. It is as easy as typing `python manage.py syncdb`. It will look like this:
149+
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:
148150

149-
(myvenv) ~/djangogirls$ python manage.py syncdb
150-
Creating tables ...
151-
Creating table blog_post
152-
Installing custom SQL ...
153-
Installing indexes ...
154-
Installed 0 object(s) from 0 fixture(s)
151+
(myvenv) ~/djangogirls$ python manage.py makemigrations blog
152+
Migrations for 'blog':
153+
0001_initial.py:
154+
- Create model Post
155155

156-
It would be nice to see this Post model, right? Jump to the next chapter to see what your Post looks like!
156+
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:
157+
158+
(myvenv) ~/djangogirls$ python manage.py migrate blog
159+
Operations to perform:
160+
Apply all migrations: blog
161+
Running migrations:
162+
Applying blog.0001_initial... OK
163+
164+
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!

django_start_project/README.md

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,16 @@ This is already set up in this part of your `mysite/settings.py` file:
6868
}
6969
}
7070

71-
To create a database for our blog, let's run the following in the console: `python manage.py syncdb` (we need to be the `djangogirls` directory that contains the `manage.py` file). If that goes well, you should see something like this:
72-
73-
(myvenv) ~/djangogirls$ python manage.py syncdb
74-
Creating tables ...
75-
Creating table django_admin_log
76-
Creating table auth_permission
77-
Creating table auth_group_permissions
78-
Creating table auth_group
79-
Creating table auth_user_groups
80-
Creating table auth_user_user_permissions
81-
Creating table auth_user
82-
Creating table django_content_type
83-
Creating table django_session
84-
85-
You just installed Django's auth system, which means you don't have any superusers defined.
86-
Would you like to create one now? (yes/no): yes
87-
Username (leave blank to use 'Name'):
88-
Email address: [email protected]
89-
Password:
90-
Password (again):
91-
Superuser created successfully.
92-
Installing custom SQL ...
93-
Installing indexes ...
94-
Installed 0 object(s) from 0 fixture(s)
95-
96-
It will ask you if you want to create a *superuser* - a user which has control over everything on the site. Type `yes`, press enter and type your username (lowercase, no spaces), email address and password when you're asked for them. Remember this username and password! We'll use it later.
71+
To create a database for our blog, let's run the following in the console: `python manage.py migrate` (we need to be in the `djangogirls` directory that contains the `manage.py` file). If that goes well, you should see something like this:
72+
73+
(myvenv) ~/djangogirls$ python manage.py migrate
74+
Operations to perform:
75+
Apply all migrations: admin, contenttypes, auth, sessions
76+
Running migrations:
77+
Applying contenttypes.0001_initial... OK
78+
Applying auth.0001_initial... OK
79+
Applying admin.0001_initial... OK
80+
Applying sessions.0001_initial... OK
9781

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

django_urls/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ There is no "It works" anymore, huh? Don't worry, it's just an error page, nothi
9292

9393
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.
9494

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

django_views/README.md

Lines changed: 1 addition & 1 deletion
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.6/topics/http/views/
33+
> Learn more about Django views by reading the official documentation: https://docs.djangoproject.com/en/1.7/topics/http/views/

dynamic_data_in_templates/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ So finally our `blog/views.py` file should look like this:
5656

5757
That's it! Time to go back to our template and display this QuerySet!
5858

59-
If you want to read a little bit more about QuerySets in Django you should look here: https://docs.djangoproject.com/en/1.6/ref/models/querysets/
59+
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/
6060

6161

6262

whats_next/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ After that make sure to:
1515

1616
Yes! First, go ahead and try our other book, called [Django Girls Tutorial: Extensions](http://djangogirls.gitbooks.io/django-girls-tutorial-extensions/).
1717

18-
Later on, you can try recources listed below. They're all highly recommended!
19-
- [Django's official tutorial](https://docs.djangoproject.com/en/1.6/intro/tutorial01/)
18+
Later on, you can try recources listed below. They're all very recommended!
19+
- [Django's official tutorial](https://docs.djangoproject.com/en/1.7/intro/tutorial01/)
2020
- [New Coder tutorials](http://newcoder.io/tutorials/)
2121
- [Code Academy Python course](http://www.codecademy.com/en/tracks/python)
2222
- [Code Academy HTML & CSS course](http://www.codecademy.com/tracks/web)
2323
- [Django Carrots tutorial](http://django.carrots.pl/en/)
2424
- [Learn Python The Hard Way book](http://learnpythonthehardway.org/book/)
2525
- [Getting Started With Django video lessons](http://gettingstartedwithdjango.com/)
2626
- [Two Scoops of Django: Best Practices for Django](http://twoscoopspress.org/products/two-scoops-of-django-1-6) book
27-

0 commit comments

Comments
 (0)