Re: managing templates(html pages)

2009-04-30 Thread Malcolm Tredinnick

On Thu, 2009-04-30 at 15:14 -0700, Frutoso wrote:
> Hello all - I am new to Django development and I have a question about
> templates.
> 
> I have many templates(html pages) and want to know the best way to
> manage them all. For example:
> I have business_form.html: to get data
> I have business.html: to display data
> and so on.
> 
> Now, if I change a link in the navigation portion of my page I will
> have to change them in all my html pages if I want the pages to all
> look alike. There has got to be a way to manage this better. Please
> help.
> 
> I have used asp.net in the past and it uses a feature call
> master.pages which manages this for all pages. Is there something like
> that for Django?

There's a similar hierarchy structure in Django, although the main
method is based on extension, rather than inclusion. Read about the
"extends" template tag. You would typically put the navigation portion
into a base template and also have blocks (probably empty) that are
placeholders for the main content. Then you "extend" the base template
in a child and override the content blocks, putting the final content
into them. That's very normal Django practice and very simple to use.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: managing templates(html pages)

2009-04-30 Thread Laszlo Antal


On Thu, 30 Apr 2009 3:14 pm, Frutoso wrote:
>
> Hello all - I am new to Django development and I have a question about
> templates.
>
> I have many templates(html pages) and want to know the best way to
> manage them all. For example:
> I have business_form.html: to get data
> I have business.html: to display data
> and so on.
>
> Now, if I change a link in the navigation portion of my page I will
> have to change them in all my html pages if I want the pages to all
> look alike. There has got to be a way to manage this better. Please
> help.
>
> I have used asp.net in the past and it uses a feature call
> master.pages which manages this for all pages. Is there something like
> that for Django?
>
> Thanks,
> Frutoso
>
Hi,

Not sure.
Do you have the navigation portion in all of your files?
If so create a file called base_business.html
Put all your navigation in there and extend this file in your other 
files.

Hope that helps

lzantal


> Laszlo Antal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



managing templates(html pages)

2009-04-30 Thread Frutoso

Hello all - I am new to Django development and I have a question about
templates.

I have many templates(html pages) and want to know the best way to
manage them all. For example:
I have business_form.html: to get data
I have business.html: to display data
and so on.

Now, if I change a link in the navigation portion of my page I will
have to change them in all my html pages if I want the pages to all
look alike. There has got to be a way to manage this better. Please
help.

I have used asp.net in the past and it uses a feature call
master.pages which manages this for all pages. Is there something like
that for Django?

Thanks,
Frutoso

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---