List Info

Thread: Dynamic template extension




Dynamic template extension
user name
2006-05-30 17:09:34
Hi Folks,

I'm wondering if there's a way to include dynamic
(context) data in an
{% extends %} statement.

I don't seem to be able to do {% extends "base_{}_.html" %}
for instance.

Thanks, Tom


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Dynamic template extension
user name
2006-05-30 17:43:20
tomass wrote:

>I don't seem to be able to do {% extends "base_{}_.html" %}
>for instance.
>  
>
You can use the variable here like this:

    {% extends some_var %}

But without anything fancy like concatenations. You should
hence set 
some_var to a full template name before it gets into the
context.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Advice on meta applications
user name
2006-05-30 20:53:37
Looking for some advice on how to handle my little problem,
all help 
gratefully appreciated.

Apologies it's quite long.

Story thus:

I need to build an application for holding a simple
inventory of 
components in the IT estate: servers, applications, network
switches, 
etc.  They all have a core set of common attributes (e.g.
identifier), 
while there are also attributes specific to the class of
node (e.g. IP 
address for hardware devices).

A classic case for subtyping; except (1) it's not yet
supported, and (2) 
the list of types needs to be extensible at run time.

So I have a 5 class model: component, component type,
property, property 
type, and value.  Components are modelled as instances of
component type 
(i.e. each component is instance of exactly 1 component
type).  Each 
Component type defines 0 or more properties; each property
is of exactly 
one property type.  Each component has a value for each
property defined 
by its component type.

(Hope that makes sense, it's a lot easier as a picture).

This all works fine, except of course adding components in
the admin 
interface is not intuitive at all (since their properties
are shown on 
separate pages).

Now the pattern I have is basically the same as the model
for data 
models (table has many columns, each of a type; row has
value for each 
column).  So in a sense I'm repeating a pattern already
known to Django.

Which circuitously brings me to the questions:

  - is there a way to get the admin interface to generate a
page with 
fields for all the right component fields depending on its
type?
  - I'd like to use the django field types as my property
types - can I 
query this list programmatically?

Apologies for long post, thanks for any help.

  - S.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Advice on meta applications
user name
2006-05-30 22:30:46
are you planning on open sourcing this?
if so I'd be glad to help as I have a similar app for a
client.

On 31/05/2006, at 6:53 AM, Scott Finnie wrote:

>
> Looking for some advice on how to handle my little
problem, all help
> gratefully appreciated.
>
> Apologies it's quite long.
>
> Story thus:
>
> I need to build an application for holding a simple
inventory of
> components in the IT estate: servers, applications,
network switches,
> etc.  They all have a core set of common attributes
(e.g. identifier),
> while there are also attributes specific to the class
of node (e.g. IP
> address for hardware devices).
>
> A classic case for subtyping; except (1) it's not yet
supported,  
> and (2)
> the list of types needs to be extensible at run time.
>
> So I have a 5 class model: component, component type,
property,  
> property
> type, and value.  Components are modelled as instances
of component  
> type
> (i.e. each component is instance of exactly 1 component
type).  Each
> Component type defines 0 or more properties; each
property is of  
> exactly
> one property type.  Each component has a value for each
property  
> defined
> by its component type.
>
> (Hope that makes sense, it's a lot easier as a
picture).
>
> This all works fine, except of course adding components
in the admin
> interface is not intuitive at all (since their
properties are shown on
> separate pages).
>
> Now the pattern I have is basically the same as the
model for data
> models (table has many columns, each of a type; row has
value for each
> column).  So in a sense I'm repeating a pattern
already known to  
> Django.
>
> Which circuitously brings me to the questions:
>
>   - is there a way to get the admin interface to
generate a page with
> fields for all the right component fields depending on
its type?
>   - I'd like to use the django field types as my
property types -  
> can I
> query this list programmatically?
>
> Apologies for long post, thanks for any help.
>
>   - S.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Dynamic template extension
user name
2006-05-31 08:54:55
Great, this seems to work a treat!

Thanks, Tom


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )