python -m venv env
source env/bin/activate
pip install django
django-admin startproject config .
python manage.py startapp jobboard
- Update
INSTALLED_APPS
insettings.py
- Update
views.py
andurls.py
python manage.py makemigrations
python manage.py migrate
python manage.py shell
to enter the shellfrom jobboard.models import JobPosting
JobPosting.objects.all()
JobPosting.objects.get(id=1)
JobPosting.objects.create(title='full stack developer', description='an awesome job', company='ABC tech', salary=120000)
job = JobPosting.objects.get(id=1)
job
job.description = "A good job"
to update the descriptionjob.save()
python manage.py createsuperuser
( enter username and password)- Go to
http:localhost:8000/admin
and login
admin.site.register(JobPosting)
so that it doesn’t show JobPosting Object in the Panel
def __str__(self):
return f"{self.title} | {self.company}"