Skip to content

Commit

Permalink
Merge pull request #12 from agiliq/review_of_doc
Browse files Browse the repository at this point in the history
review first chapter
  • Loading branch information
yashrastogi16 committed Mar 15, 2018
2 parents 576096f + 6fbc9e2 commit a9fd3ad
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions docs/setup-models-admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ We will use SQlite database, which is already included with Python. The :code:`p
}
}
Now, use the migrate command which builds the needed database tables in regard to the "django_pollsapi/settings.py" file.
Now, use the migrate command which builds the needed database tables in regard to the :code:`django_pollsapi/settings.py` file.

.. code-block:: python
Expand All @@ -63,11 +63,12 @@ Before creating our database models, let us create our pollsapi App.
The above command results in a 'polls' directory containing different files::

admin.py
apps.py
models.py
tests.py
views.py

Step in to 'models.py' file and start writing the models. For creating the polls api we are going to create a :code:`Poll` model, a :code:`Choice` model and a :code:`Vote` model. Once we are done with designing our models, the 'models.py' file should look like this:
Step in to 'models.py' file and start writing the models. For creating the polls api we are going to create a :code:`Poll` model, a :code:`Choice` model and a :code:`Vote` model. Once we are done with designing our models, the :code:'models.py' file should look like this:

These models are the same as you would have seen in the Django introduction tutorial.

Expand Down Expand Up @@ -122,8 +123,11 @@ Now, run the :code:`makemigrations` command which will notify Django that new mo

.. code-block:: python
python manage.py makemigrations polls
python manage.py migrate
$ python manage.py makemigrations polls
$ python manage.py migrate
Create an empty :code:`urls.py` in your :code:`polls` app.

Expand All @@ -142,6 +146,13 @@ Go to :code:`pollsapi/urls.py` and include the polls urls.
url(r'^', include('polls.urls')),
]
Now you can runserver ::

$ python manage.py runserver


Goto any browser of your choice and hit the url :code:`http://127.0.0.1:8000`

And we are in business, with a Django *Congratulations* page greeting us. (Though we haven't added any API endpoints yet.)

.. image:: congrats.png
Expand Down

0 comments on commit a9fd3ad

Please sign in to comment.