Re: Multiple apps in one view

2010-05-24 Thread Scott Gould
> Can you run multiple apps in one view, and what would be the best way
> to do that.

Firstly you can't "run an app" as such. Think of apps as folders on
your desktop -- they organise and compartmentalise in Django.

> Let's say I have two apps and I want to display some items from app1
> and some from app2 in the same view. I understand that it would be a
> good idea to create a third app, but I don't want to violate the dry
> principals. Now I've seen the template tag pass, and the context
> processor, but I can't really find a conclusive way as to how to do
> this the right way.

Pick which app the view "belongs" to most, and put it there. Then just
"from  import ". If you can't decide,
then that's probably an indicator it shouldn't be in either.

There's nothing about creating a third app that violates DRY; don't
repeat yourself refers to duplicating knowledge, not code per se. I
often have apps who don't really do much other than amalgamate
smaller, more tightly-focused apps.

Template tags and context processors are just tools -- you're talking
architecture and organisation at this point.

Regards
Scott

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Multiple apps in one view

2010-05-23 Thread Jasper Kennis
Hello,

Can you run multiple apps in one view, and what would be the best way
to do that.

Let's say I have two apps and I want to display some items from app1
and some from app2 in the same view. I understand that it would be a
good idea to create a third app, but I don't want to violate the dry
principals. Now I've seen the template tag pass, and the context
processor, but I can't really find a conclusive way as to how to do
this the right way.

Is there an article about this somewhere, or can template tags and
context processors solve my problem?

Kind regards,


Jasper Kennis

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.