Previous Lesson: Lesson 31: Add More Hobbies On Django Administration
We have done a lot of things on all our previous lessons just to create our Hobby model and add some things to it. So, we may have been feeling some dizziness because of all that, don’t you agree? So, may this lesson serve as a “reviewer” for you as we start making our Projects model in Django! Let’s start!
models.py
We’ll start here on our project’s models.py:
I’ll type these down:
settings.py
Here from our apps.py, we’ll copy this:
And then go here on our settings.py‘s INSTALLED_APPS:
Afterwards, we’ll add this line here:
Nice.
admin.py
Now here on our projects’s admin.py:
We’ll add these lines:
migrations
First, let’s makemigrations:
ENTER:
Now, let’s migrate:
ENTER:
Git Commit
I think it would be nice to commit all these changes. Don’t worry if my files’s version changes are not the same as yours. Just commit it:
Good.
PROJECTS
Let’s start running the server:
Refresh (if needed):
Yes! We now have our Projects model. Let’s click on that:
We’re now done making our Projects model in Django. Finally, we can start adding up our projects here.
Adding Our Projects in Django Model
Let’s take a look at our website’s blueprint (sketch) here:
So, I wanted to add my WORDCOUNT project here. Okay.
I’ll add it:
Then, I’ll SAVE this:
I now have one project made! Then, I’ll add another one. According to my sketch, it would be about the project that we are working on right now–portfolio website. I’ll just right something about it:
Then SAVE:
There’s now two projects here. Last one:
Alright. I’ll SAVE:
Nice. I now have three of my projects here on my model! We’ll see all these, along with the Hobbies, after we’ve taken care of the layout of our portfolio website.