Re: templates couple apps to a site; how do you separate them?

2012-03-14 Thread bruno desthuilliers
On Mar 14, 2:31 am, Ken  wrote:
> I'm struggling with how I should go about writing "pluggable" apps.  I
> haven't found a satisfactory way of decoupling apps from a site and
> the primary sticking point is templates.  I've combed through some
> discussions but have not found any that have helped.
>
> A site's templates determine the look and feel.  If an app is to play
> nice, then it needs to know a site's templates.  If an app uses its
> own templates, then it can override the site's look and feel.

The simplest solution is to provide barebones templates within the app
and let the project team override them.

-- 
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: templates couple apps to a site; how do you separate them?

2012-03-13 Thread Nick
When writing an app one of the things you do is set limitations. It's
the same for people who choose to use pluggable apps, you're trading
customization for convenience.

The way I would go about it is to write multiple outputs that are
handled primarily in the view. You could set up a keyword parameter
that checks the template type, if it's html, serve up the information
with HTML, if the type is JSON, then send JSON to the template or
other view. You could also allow for different wrappers for your
content. Many Wordpress plugins (interchangeable with the term apps)
allow you to set the before and after html for the entire list of
objects and even set HTML elements for the individual objects in the
list. You then deliver the HTML as a variable to the template and the
template just outputs the HTML.

I wouldn't rely on a separate template file to create my output. If
you do go that route then try adding a keyword that would allow a
template override so someone could customize the presentation from the
ground up if they wanted.




On Mar 13, 7:31 pm, Ken  wrote:
> I'm struggling with how I should go about writing "pluggable" apps.  I
> haven't found a satisfactory way of decoupling apps from a site and
> the primary sticking point is templates.  I've combed through some
> discussions but have not found any that have helped.
>
> A site's templates determine the look and feel.  If an app is to play
> nice, then it needs to know a site's templates.  If an app uses its
> own templates, then it can override the site's look and feel.
>
> One approach is for an app to provide only functionality.  A site that
> uses an app then has the responsibility of developing views for an app
> it chooses to use.  This seems to me the best way forward.
>
> How do you go about solving this problem?
>
> Thanks.

-- 
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.



templates couple apps to a site; how do you separate them?

2012-03-13 Thread Ken
I'm struggling with how I should go about writing "pluggable" apps.  I
haven't found a satisfactory way of decoupling apps from a site and
the primary sticking point is templates.  I've combed through some
discussions but have not found any that have helped.

A site's templates determine the look and feel.  If an app is to play
nice, then it needs to know a site's templates.  If an app uses its
own templates, then it can override the site's look and feel.

One approach is for an app to provide only functionality.  A site that
uses an app then has the responsibility of developing views for an app
it chooses to use.  This seems to me the best way forward.

How do you go about solving this problem?

Thanks.



-- 
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.