Creating and Displaying Django Model Objects with Admin Panel In this tutorial, we'll walk through creating a Django superuser, registering a model with the admin panel, uploading objects, and displaying those objects dynamically on a web page using Django templates. ๐ค Step 1: Create a Superuser To access Django's admin panel and manage your database through a GUI, create a superuser: python manage.py createsuperuser You’ll be prompted to enter: Username Email (optional) Password Once created, your superuser will be able to log in at: ๐ http://localhost:8000/admin ๐งพ Step 2: Register the Model in admin.py Open jobs/admin.py and register the Job model: from django.contrib import admin from .models import Job admin.site.register(Job) This makes the Job model accessible and editable via the Django admin panel. ๐ผ️ Step 3: Add a Job via Admin Panel Go to http://localhost:8000/admin Log in with your superuser credentials Click on Jobs → Add Upload an image (e.g., code.jpg ) a...
Comments
Post a Comment