List Info

Thread: How do I make something available everywhere?




How do I make something available everywhere?
user name
2006-08-31 13:53:04
I want to tap into the Amazon Web Services to provide a
little revenue
stream.

I'm pretty confident about writing a funtion that will get
the
appropriate xml from Amazon and parse it out, as I'm
already tapping
into google maps and bringinig in an external rss feed. That
part I
think I've got.

What I don't understand (and I know this is a total newbie
question) is
how I do this so it's available to drop in on any page I
like.

If I write a view, then that view will be associated with a
certain url
through urls.py, right?

Do I need a view? Should I just write a template tag?

Or is this what the extra context thing is all about?


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

How do I make something available everywhere?
user name
2006-08-31 14:05:14
On 8/31/06, baxtergretschpages.com <baxtergretschpages.com> wrote:
> Do I need a view? Should I just write a template tag?

I'd go with a template tag.

> Or is this what the extra context thing is all about?

It is possible to write "context processor"
functions which will add
extra items to the context of every template which uses
RequestContext
instead of the base Context class (generic views all use
RequestContext, and using it for your own views is a trivial
change).
But given the use case here, I'd lean more toward a
template tag --
that gives you a little more flexibility.

-- 
"May the forces of evil become confused on the way to
your house."
  -- George Carlin

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

How do I make something available everywhere?
user name
2006-08-31 14:06:35
> What I don't understand (and I know this is a total
newbie question) is
> how I do this so it's available to drop in on any page
I like.

I'd suggest a template tag. That way you could (for
example) put the tag
into your base template and it'll show up on all pages that
extend it,
without being tied to any view-specific logic.

-- 
Bryan L. Fordham
socialistsushi.com
Sushi For Everyone

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

How do I make something available everywhere?
user name
2006-08-31 14:16:52
So just so I'm clear, I'll need to create an app (we'll
call it amazon)
that will have an empty models.py AND an empty views.py
(since I don't
want this in the DB, and I don't want it tied to any
particular view)
but WILL contain a templatetags folder for my little
function.

Right?


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

How do I make something available everywhere?
user name
2006-08-31 14:59:32
On 8/31/06, baxtergretschpages.com <baxtergretschpages.com> wrote:
> So just so I'm clear, I'll need to create an app
(we'll call it amazon)
> that will have an empty models.py AND an empty views.py
(since I don't
> want this in the DB, and I don't want it tied to any
particular view)
> but WILL contain a templatetags folder for my little
function.

Yes. But you can delete the models.py and views.py files --
Django
doesn't require that they exist.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

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

How do I make something available everywhere?
user name
2006-08-31 17:39:28
Is there a trick to making the templatetag files compile?

I have

amazon
>__init__.py
>__init__.pyc
>templatetags
>> amazon.py
>>__init__.py

No matter what I try, nothing in the templatetag folder
seems to want
to compile.


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

How do I make something available everywhere?
user name
2006-08-31 17:50:27
On 8/31/06, baxtergretschpages.com <baxtergretschpages.com> wrote:
> No matter what I try, nothing in the templatetag folder
seems to want
> to compile.

Assuming
"
import amazon
"
works, does
"
from amazon.templatetags import amazon
"
work?

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

How do I make something available everywhere?
user name
2006-08-31 18:09:44
Ahh, it gets compiled when it's called. Duh. 

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-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-8]

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