Skip to content

Commit

Permalink
First admin bit
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Feb 6, 2015
1 parent 44a8a5e commit 4c3a328
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 277 deletions.
272 changes: 0 additions & 272 deletions academy_invites_2014.csv

This file was deleted.

36 changes: 32 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -545,18 +545,46 @@ You've done it. The CSV is loaded into the database.
Act 4: Hello admin
------------------

One of Django's unique features is that it comes with a custom administration that allows users to view, edit and create records. To see it in action, create a new superuser with permission to edit all records.

.. code-block:: bash
$ python manage.py createsuperuser
Then fire up the Django test server.

.. code-block:: bash
$ python manage.py runserver
And visit `localhost:8000/admin/ <http://localhost:8000/admin/>`_ and log in using the credentials you just created.

SCREENSHOT HERE

Without any additional configuration you will see administration panels for the apps installed with Django by default.

SCREENSHOT HERE

Adding panels for your own models is done in the ``admin.py`` file included with each app. Open ``academy/admin.py`` to start in.

.. code-block:: python
from django.contrib import admin
from academy.models import Invite
admin.site.register(Invite)
Now reload `localhost:8000/admin/ <http://localhost:8000/admin/>`_ and you'll see it in action.

- Configure the admin vanilla.
- Create a superuser
- Check out how the vanilla admin looks
- Configure an admin for our model
- Tweak our admin so it's nicer
- Create users for the reporters

Then create a new superuser with permission to edit all records.
Then

.. code-block:: bash
$ python manage.py createsuperuser

- Create an admin to access and edit the new model
- Gradually refine it so it's better
Expand Down
3 changes: 2 additions & 1 deletion project/academy/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib import admin
from academy.models import Invite

# Register your models here.
admin.site.register(Invite)
Binary file modified project/db.sqlite3
Binary file not shown.

0 comments on commit 4c3a328

Please sign in to comment.