Monday, January 18, 2016

Re: date picker

On Tue, Jan 19, 2016 at 09:56:49AM +1100, sum abiut wrote:
> Hi Michal,
>
>
> here is my template.html, i believe it has all the required java script,
> Yes the origin template was copy past from this template.

Hi Sum,

I asked for the rendered output HTML, not the original template. But
mostly I'm just interested in whether the rendered output contains all
the stuff that appears before the following line::

{%extends "loginpage.html"%}

I've never seen this kind of usage of template inheritance, and I'd
suspect that it is wrong. When template a.html extends base.html, then
a.html will contain everything from base.html, except for the blocks
it overrides. In this case, you only override the block named
"content", so that should be the only difference compared to
"loginpage.html". Everything that appears outside {% block content %}
is probably ignored. (I'd expect the template parser to raise an
error in this case, but I may be wrong.)

The idiomatic way of using template inheritance is to create a common
base.html, which will contain the general structure of your HTML
output, and a bunch of empty block definitions to be filled by its
descendants, such as "content", "extra_head", etc. Then, in
loginpage.html you override "content", and in form.html you override
both "extra_head" (with the datepicker javascript), and "content".

Good luck,

Michal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160118232831.GD20308%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment