Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Display a Single Project: Recap

Congratulations on making it nearly to the end of this section! Here’s what you did:

  • Used the Django ORM in the shell and in
  • Learned about primary keys (pk)
  • Used angle brackets in your path objects in order to be able to capture specific parts of a URL and pass them forward as arguments
  • Used an int: path converter to verify the URL path’s datatype
  • Defined proper namespaces for linking and reverse URL matching
  • Passed objects inside URL template tags
  • Debugged the NoReverseMatch error
  • Learned about template inheritance
  • Styled with Bootstrap
  • Made the site mobile responsive
  • Used the Django admin interface

On top of all that, you also have a functioning portfolio site that you can show to potential employers!

00:00 Hey, and welcome to this nearly final section of the course where, in old tradition, we’re going to recap what we did in this section. We started off using the Django ORM—first in a shell and then, later on, we also built it in the We used it, in this case, to access one specific item from our database, and we did that using primary keys.

00:23 We learned about this pk variable that you might see around in different Django projects and how it relates to the id column that gets automatically generated.

00:32 The next thing we did is we used angled brackets inside of our path() objects

00:39 in order to be able to capture specific parts of a URL. Then, we were able to pass those forward as arguments, eventually. What we did before actually passing it on is we used the path converter—in our case, an integer path converter—to make sure that what the user enters in the URL is actually going to be useful for what we’re passing forward to the view. In our case, we wanted to make sure that this is an integer and not some kind of string.

01:09 Then, we dove a bit into how does this linking between different templates work. So, we made sure that we know how to define proper namespaces. That helps us both in linking templates together, as well as reverse URL matching.

01:23 And what’s necessary for that is to define the right things in We need to define the app_name variable, and we need to define the name keyword for each of our path() objects.

01:36 Another thing we took a look at is how do we deal with this if our path() requires arguments. So, when we’re using these angled brackets and then we want to link forward, we also need to pass that argument so that we can actually find the correct URL.

01:51 Yeah, we talked about how to do that correctly.

01:55 We also took it as a chance to debug the NoReverseMatch error, an error that you might see very often. We narrowed it down to looking at two files, specifically: and whichever template you’re using .html. Make sure that two important things are squared out.

02:13 So, we want to make sure that Django can identify the right view. We need the namespace for this, so, app_name and the name of the path(), as well as that in case we’re passing arguments, that this is done correctly.

02:26 So, check out this debugging video again, for the process of where to look and how to make sure that—most likely—you’re going to resolve your NoReverseMatch error if you follow these steps.

02:37 Then, we went forward to take a look at template inheritance. We did this following the DRY principle, which means don’t repeat yourself. So, we tried to get rid of a lot of repetitive HTML code that we had in our project by just creating one parent template that the other templates are inheriting from. The two important parts for this is we need to create this {% block content %} with {% endblock %} that opens the space where the child templates can put in the HTML.

03:05 We also need to extend the name of whatever is our parent template. Two simple steps allows us to get rid of quite a lot of repetitive code.

03:16 After creating this base template, we also took a stab at making our style a bit better. We created a Bootstrap header inside of base.html that would appear on all of the pages that we create.

03:29 We also took a very simple step to make our site mobile-responsive by just adding this line of code inside of our base.html. And just to give you a heads up, this doesn’t necessarily always work for each page.

03:43 This just works because we’re using Bootstrap, and Bootstrap is designed for being mobile-responsive. That’s why adding this line of code actually helps us to make it look so good also on a smaller device. Finally, we took a look at the Django admin interface.

04:00 We had to first create a superuser to be able to access it. Then, we needed to register our models, the Project model, in our Django admin.

04:10 We did that in in our project. After we had done all this, it allowed us to very easily add, edit, or delete database entries in a very convenient way. You can see here, the mobile-responsive admin interface and how I can simply add things here, or edit it, and keep your database up-to-date, essentially, which is crucial if you want to have a good portfolio that you can also show to people. And that’s it! Congratulations!

04:40 You did a good job. If you went through this whole tutorial, you now have a functioning portfolio site that actually looks pretty good, that allows you to keep it up-to-date pretty easily, and I hope you go ahead and add all the cool projects that you’ve built already. Put in a screenshot, put some description, and if you show this project to some potential employers, I’m sure that they’re going to be impressed.

05:04 So, let’s take a quick look at what we built.

05:09 What you should have so far if you followed everything is a project that looks like this. We have a navigation bar up top. Currently, this just takes us to our project index page where we have all of the projects. They’re listed up like this.

05:24 We can click on those to get to a details view of each entry in our database and click up here to get back again. Click here, it takes us to a different one. Everything looks pretty nice already.

05:37 We have some description about the project, technologies that it was built with, and an image.

05:44 We also have the admin interface that Django comes built-in with,

05:50 and it allows us to add a project or delete a project very easily…

06:22 which then also gets reflected right away on our project page.

06:30 So, that’s it for today. I’m Martin and I hope you enjoyed this mini-course on getting started with Django, building your portfolio app. I want to thank you for going all the way through the course, and I want to make sure that you also head over to the final video where I’m going to talk a little bit about next steps on what you can do to make your portfolio look even more awesome than it already does. All right, see you in the final video.

Paul on Nov. 1, 2019

Thanks for the awesome course martin!

Martin Breuss RP Team on Nov. 2, 2019

Thanks for the kind words and also for your contribution in the comments @Paul! :)

reblark on Nov. 14, 2019

“Mini course?” Damn. Took me forever thanks to my total inadequacy in typing code. But, it was great and I learned a lot from making all the mistakes. They forced me to read more and to understand what I was reading. I can honestly say that I don’t fully understand everything so I will repeat the course again and again. Thank you, Martin.

kal on Nov. 28, 2019

Excellent intro to Django!

Leonard Coman on Nov. 29, 2019

Martin, awesome intro to Django! Thanks

Martin Breuss RP Team on Dec. 2, 2019

Glad it was useful for you @kal, @Leonard Coman and @reblark. : )

marcinmukosiej on Dec. 16, 2019

Really good basics! Please make advanced level of this ‘Portfolio website with Django’ as it made me to buy the subscription :)

I do expect more from ‘your future employers will be impressed’, please.

That was fun!

aradim on Dec. 25, 2019

Thanks, fantastic course ! i have learned a lot. More advanced in the future please.

emalfiza on March 22, 2020

Congrats to you the master @Martin! such an amazing and clear step to step project. Upcoming week I have to build a Django Milestone project from my Fullstack Web Development diploma and I really needed a such a teacher to take my hand and explain every bits and bytes…a round of applause to you.

Thank you indeed

Dave Wilson on April 1, 2020

I’m so grateful for this! What a great course, thank you so much Martin!

Andrew E on April 7, 2020

Brilliant, thanks for a great course Martin, I really enjoyed it. I had previously seen Django built websites, and tried to reverse engineer my understanding of them, which was completely fruitless. This was a much more efficient way to learn it, and gave me a much deeper understanding. Thanks again for a super course, you’re a great teacher.

Martin Breuss RP Team on April 7, 2020

Hi all! Thanks for your positive words, glad you’ve found value in the course :) Noted regarding the more advanced Django topics!

JellyNeck on April 12, 2020

Thanks Martin! I really enjoyed the class!

hrmessi709 on April 20, 2020

very lucid and a structured course. way to go martin.

MrUzo on April 24, 2020

Good job Martin!! I’m not actually new to Django, but i learned some easier ways to do some tasks. Thanks for making this so clear to follow.

I need some help with making AJAX calls in Django? Can you point me in the right direction?

Abhishek on May 9, 2020

Good job Martin, you really made it fun with all those brilliantly placed emojis! :) Keep it up

Konstantin Schukin on June 15, 2020

Thanks for wonderful Django course Martin! Your course helped me understand how it works.

Scretch on June 16, 2020

Ditto my fellow devs. Thank you Martin! this was a great course. I will certainly be on the lookout for more content from you.

Rachel Hill on Aug. 17, 2020

Thank you! I’m a database developer and the front-end has always been a mystery to me. After completing this course, I’m so pleased to have a new tool added to my my toolbelt. The debugging was especially useful.

Become a Member to join the conversation.