Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Forms Model Forms Using a Model Form

Nursultan Bolatbayev
Nursultan Bolatbayev
16,774 Points

The purpose of block.super?

I cant understand the purpose of block.super in template. If I delete it nothing is changed. It says it loads a content from parent template, but which?

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

When a template is rendered, any blocks defined will overwrite the content in the extended template. Using the block.super will retain the content that is in the extended parent template. If the parent template block has no content, such as:

{% block title %}{% endblock title %}

There is no parent content to include, so removing the block.super reference won't change anything.

If this is not your case, then please post the section of the extended template containing the referenced block and the current template referencing block.super.

Jacinto Jacinto
seal-mask
.a{fill-rule:evenodd;}techdegree
Jacinto Jacinto
Python Web Development Techdegree Student 7,869 Points

Hey Chris! I took a long break from my techdegree and im getting back into it. Regarding login required and user authentication, what lesson did we cover that? How do I log into mysite, we dont even have user models.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

Off hand, I don’t remember the specific lesson. You can use the manage module to create a new superuser admin login.

$ python manage.py createsuperuser

Then, login in as admin to create new users as needed.

Post back if you need more help. Good luck!!!