diff --git a/django_admin/README.md b/django_admin/README.md index e09cedb719e..9a1d59a7252 100644 --- a/django_admin/README.md +++ b/django_admin/README.md @@ -19,7 +19,16 @@ You will see a login page like this: ![Login page](images/login_page2.png) -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. +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): + + (myvenv) ~/djangogirls$ python manage.py createsuperuser + Username: admin + Email address: admin@admin.com + Password: + Password (again): + Superuser created successfully. + +Return to your browser and log in with the superuser's credentials you chose, you should see the Django admin dashboard. ![Django admin](images/django_admin3.png) @@ -29,7 +38,7 @@ Make sure that at least two or three posts (but not all) have the publish date s ![Django admin](images/edit_post3.png) -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/ +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/ 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! diff --git a/django_forms/README.md b/django_forms/README.md index 8197f80772b..2e4a66f32fe 100644 --- a/django_forms/README.md +++ b/django_forms/README.md @@ -284,7 +284,7 @@ Feel free to change the title or the text and save changes! Congratulations! Your application is getting more and more complete! -If you need more information about Django forms you should read the documentation: https://docs.djangoproject.com/en/1.6/topics/forms/ +If you need more information about Django forms you should read the documentation: https://docs.djangoproject.com/en/1.7/topics/forms/ ## One more thing: deploy time! diff --git a/django_installation/README.md b/django_installation/README.md index 1781ec7a880..8a03528ab0e 100644 --- a/django_installation/README.md +++ b/django_installation/README.md @@ -88,10 +88,10 @@ OK, we have all important dependencies in place. We can finally install Django! ## Installing Django -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: `==`). +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: `==`). - (myvenv) ~$ pip install django==1.6.6 - Downloading/unpacking django==1.6.6 + (myvenv) ~$ pip install django==1.7 + Downloading/unpacking django==1.7 Installing collected packages: django Successfully installed django Cleaning up... diff --git a/django_models/README.md b/django_models/README.md index ad18fe53b30..6d62e1d6987 100644 --- a/django_models/README.md +++ b/django_models/README.md @@ -73,11 +73,13 @@ You will notice that a new `blog` directory is created and it contains a number | wsgi.py ├── manage.py └── blog - __init__.py - admin.py - models.py - tests.py - views.py + ├── migrations + | __init__.py + ├── __init__.py + ├── admin.py + ├── models.py + ├── tests.py + └── views.py 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: @@ -134,7 +136,7 @@ Now we define properties we were talking about: `title`, `text`, `created_date`, - `models.DateTimeField` - this is a date and time. - `models.ForeignKey` - this is a link to another model. -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). +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). 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`). @@ -144,13 +146,19 @@ If something is still not clear about models, feel free to ask your coach! We kn ### Create tables for models in your database -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: +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: - (myvenv) ~/djangogirls$ python manage.py syncdb - Creating tables ... - Creating table blog_post - Installing custom SQL ... - Installing indexes ... - Installed 0 object(s) from 0 fixture(s) + (myvenv) ~/djangogirls$ python manage.py makemigrations blog + Migrations for 'blog': + 0001_initial.py: + - Create model Post -It would be nice to see this Post model, right? Jump to the next chapter to see what your Post looks like! +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: + + (myvenv) ~/djangogirls$ python manage.py migrate blog + Operations to perform: + Apply all migrations: blog + Running migrations: + Applying blog.0001_initial... OK + +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! diff --git a/django_start_project/README.md b/django_start_project/README.md index 2560cb6648e..e6a1ad3b468 100644 --- a/django_start_project/README.md +++ b/django_start_project/README.md @@ -68,32 +68,16 @@ This is already set up in this part of your `mysite/settings.py` file: } } -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: - - (myvenv) ~/djangogirls$ python manage.py syncdb - Creating tables ... - Creating table django_admin_log - Creating table auth_permission - Creating table auth_group_permissions - Creating table auth_group - Creating table auth_user_groups - Creating table auth_user_user_permissions - Creating table auth_user - Creating table django_content_type - Creating table django_session - - You just installed Django's auth system, which means you don't have any superusers defined. - Would you like to create one now? (yes/no): yes - Username (leave blank to use 'Name'): - Email address: admin@example.com - Password: - Password (again): - Superuser created successfully. - Installing custom SQL ... - Installing indexes ... - Installed 0 object(s) from 0 fixture(s) - -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. +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: + + (myvenv) ~/djangogirls$ python manage.py migrate + Operations to perform: + Apply all migrations: admin, contenttypes, auth, sessions + Running migrations: + Applying contenttypes.0001_initial... OK + Applying auth.0001_initial... OK + Applying admin.0001_initial... OK + Applying sessions.0001_initial... OK And we're done! Time to start the web server and see if our website is working! diff --git a/django_urls/README.md b/django_urls/README.md index 17856873c38..723f0dac092 100644 --- a/django_urls/README.md +++ b/django_urls/README.md @@ -92,5 +92,5 @@ There is no "It works" anymore, huh? Don't worry, it's just an error page, nothi 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. -> If you want to know more about Django URLconfs, look at the official documentation: https://docs.djangoproject.com/en/1.6/topics/http/urls/ +> If you want to know more about Django URLconfs, look at the official documentation: https://docs.djangoproject.com/en/1.7/topics/http/urls/ diff --git a/django_views/README.md b/django_views/README.md index 78874a571ff..1f22d518147 100644 --- a/django_views/README.md +++ b/django_views/README.md @@ -30,4 +30,4 @@ Another error! Read what's going on now: This one is easy: *TemplateDoesNotExist*. Let's fix this bug and create a template in the next chapter! -> Learn more about Django views by reading the official documentation: https://docs.djangoproject.com/en/1.6/topics/http/views/ +> Learn more about Django views by reading the official documentation: https://docs.djangoproject.com/en/1.7/topics/http/views/ diff --git a/dynamic_data_in_templates/README.md b/dynamic_data_in_templates/README.md index 6d224a21b1d..338b5aad8f9 100644 --- a/dynamic_data_in_templates/README.md +++ b/dynamic_data_in_templates/README.md @@ -56,7 +56,7 @@ So finally our `blog/views.py` file should look like this: That's it! Time to go back to our template and display this QuerySet! -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/ +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/ diff --git a/whats_next/README.md b/whats_next/README.md index cd23c8fd149..35794022f84 100644 --- a/whats_next/README.md +++ b/whats_next/README.md @@ -15,8 +15,8 @@ After that make sure to: Yes! First, go ahead and try our other book, called [Django Girls Tutorial: Extensions](http://djangogirls.gitbooks.io/django-girls-tutorial-extensions/). -Later on, you can try recources listed below. They're all highly recommended! -- [Django's official tutorial](https://docs.djangoproject.com/en/1.6/intro/tutorial01/) +Later on, you can try recources listed below. They're all very recommended! +- [Django's official tutorial](https://docs.djangoproject.com/en/1.7/intro/tutorial01/) - [New Coder tutorials](http://newcoder.io/tutorials/) - [Code Academy Python course](http://www.codecademy.com/en/tracks/python) - [Code Academy HTML & CSS course](http://www.codecademy.com/tracks/web) @@ -24,4 +24,3 @@ Later on, you can try recources listed below. They're all highly recommended! - [Learn Python The Hard Way book](http://learnpythonthehardway.org/book/) - [Getting Started With Django video lessons](http://gettingstartedwithdjango.com/) - [Two Scoops of Django: Best Practices for Django](http://twoscoopspress.org/products/two-scoops-of-django-1-6) book -