We have done a lot on the previous lessons. So, may this lesson serve as a “reviewer” for you, as we start making our Projects model in Django!

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:

This image has an empty alt attribute; its file name is Screen-Shot-2020-03-13-at-3.39.37-PM-1024x518.png

We’ll add these lines:

This image has an empty alt attribute; its file name is Screen-Shot-2020-03-13-at-3.40.00-PM-1024x522.png

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:

On localhost:8000/admin:

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.

Next Lesson: Lesson 33: Create Blogs Model in Django

This article was written by Zeddrix Fabian

Zeddrix Fabian became one of Jehovah’s Witnesses on February 21, 2016, and started regular pioneering last March 2020. He wants to volunteer at Bethel⁠—that is his goal. After going to both private and public school for 10 years (Grade 1 to 8 in private; Grade 9 and 10 in public school), their family started trying homeschooling when he leveled up to Grade 11 this 2019. (Continue reading on ABOUT ZEDD menu)

Leave a Reply

Your email address will not be published. Required fields are marked *