Practical Guide to Python Practical Guide to Python

Django Tests & Final Project Practice

Check out a free preview of the full Practical Guide to Python course:
The "Django Tests & Final Project Practice" Lesson is part of the full, Practical Guide to Python course featured in this preview video. Here's what you'd learn in this lesson:

Nina explains why unit tests in Django should inherit from the TestCase class and not the built-in unit test package in Python. This segment also covers the final project practice which involves sorting blog posts and adding an is_draft field.

Get Unlimited Access Now

Transcript from the "Django Tests & Final Project Practice" Lesson

[00:00:00]
>> If you wanted to write tests for Django, know that you need to use a separate TestCase class. Not the one that comes in the standard library with Python, but instead use django.test case. And there's guides for running Django tests right here in the course website. And before we talk about the final, actually, I'll give you an overview of the final project practice and then we will wrap up.

[00:00:30] And you will be done with the day with a brain crammed full of Python knowledge. For the final project practice, you're gonna make sure that you're all set up. And then you're gonna do a few things, we're gonna sort in reverse order. So if you saw earlier, our blog posts are in chronological order, which is not what we want.

[00:00:55] We want them to sort in reverse so that the newest posts are first. We're also going to add a new is_draft fields so that we can have some posts that we're working on but we don't want displayed. And then we're also going to write or examine some unit tests.

[00:01:14] And there's some links here for going further with Django.