admin

Date: March 18th 2016
Last updated: March 18th 2016

Most of this is just a reminder. I have extracted what I wanted from https://docs.djangoproject.com/en/1.9/intro/tutorial02/. Some quick things to note, once at this stage only flush the database if you really have to. It will wipe all session and user information.

Create superuser

python3 manage.py createsuperuser

# enter at the prompt
Username (leave blank to use 'ray'): # duck
Email address: # [email protected]
Password: # lamaslayer99
Password (again): # lamaslayer99
Superuser created successfully.

Caution

# IF YOU FLUSH PRIVILEGES YOU LOOSE YOUR SUPERUSER
e.g. python3 manage.py flush

Runserver

python3 manage.py runserver 8080
# ...
# Starting development server at http://127.0.0.1:8080/

# Navigate to http://127.0.0.1:8080/admin
# Enter credentials

Update admin.py of the surferprofile app
You can modify this file while the server is running. It will update in real time.

from django.contrib import admin

from .models import Beach, Wave, Board, Fin, Trick, Surfer, SurfDiary

admin.site.register(Beach)
admin.site.register(Wave)
admin.site.register(Board)
admin.site.register(Fin)
admin.site.register(Trick)
admin.site.register(Surfer)
admin.site.register(SurfDiary)

New admin layout
Each table gets a plural.

Surfers table example (add another favourite wave)
Another window is opened with default values already entered. Drop down boxes are present to select from existing beaches.

results matching ""

    No results matching ""