Skip to content

12. Use admin mode to see edit database

Katie House edited this page Sep 15, 2020 · 1 revision

First you must register your model with Django admin. To do this, edit the iris/admin.py file with the following:

from django.contrib import admin
from .models import Predictions

@admin.register(Predictions)
class PredictionsAdmin(admin.ModelAdmin):
    pass

Now, create a superuser with the following command:

python3 manage.py createsuperuser

!! Do not forget your admin username/password !!

To access the admin site run the server and then go to: http://localhost:8000/admin

python3 manage.py runserver

You should see the following login where you can enter your credentials:

Once you enter your admin credentials, you should see your "Predictions" table under "IRIS". You can add to your table by clicking the "Add" button and entering a new row in your database.

Clone this wiki locally