Opened 12 years ago

Last modified 9 years ago

#19106 new New feature

Add new tutorial on breaking templates into blocks

Reported by: Ciro Santilli 六四事件 法轮功 包卓轩 Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords: template, tutorial, extend
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

I suggest you use the

  • extends template
  • base.html
  • the conventional title, extrahead, content_title, content, etc. blocks

combo from for the polls tutorial from the start when the template language is first used in

https://docs.djangoproject.com/en/1.4/intro/tutorial03/

since this is an absolutely fundamental design pattern.

While the "do simple now and improve later" strategy could be used (in tutorial 5, we say: wow, lets refactor some more code!), I think the direct approach is better here, since it is pretty obvious that this factors out the code.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • Unknown. The Someday/Maybe triage stage is used to keep track of high-level ideas or long term feature requests.

    It could be an issue that's blocked until a future version of Django (if so, Keywords will contain that version number). It could also be an enhancement request that we might consider adding someday to the framework if an excellent patch is submitted.

    If you're interested in contributing to the issue, raising your ideas on the django-developers mailing list certainly wouldn't hurt.

Change History (3)

comment:1 by Russell Keith-Magee, 12 years ago

Summary: Feature request: case change on visual mode with tildeAdd new tutorial on breaking templates into blocks
Triage Stage: UnreviewedSomeday/Maybe
Type: UncategorizedNew feature

I disagree - the "simple and improve later" is a much better idea.

It's easy to explain simple things. Once the basics have been grasped, you can extend and provide more complexity. If you introduce the complexity early, you have to say "just do this, and ignore the reasons why", which leads to cargo-culting.

So - marking this ticket as someday/maybe, for the purposes of introducing a new tutorial step on template blocking.

comment:2 by Matt Seymour, 9 years ago

I agree completely with @russellm comment. Could the tutorials maybe include an end of section "Something to look at next" where we could list some simple improvements or additional features the user could attempt?
This section would purely be additional reading / features the user could add it without conflicting with the tutorials in anyway.

comment:3 by Tim Graham, 9 years ago

Also raised in #26501. My comment from there:

In general, I think it's difficult for apps to provide sufficiently generic templates that will integrate into a site's layout. Some have proposed some common conventions that may work to some extent but in my opinion trying to provide reusable templates shouldn't be a big emphasis of reusable apps.

Note: See TracTickets for help on using tickets.
Back to Top