tags:

views:

56

answers:

3

How do you wrap the view of a 3rd-party app (let's call the view to wrap "view2wrap" and the app "3rd_party_app") so you can do some custom things before the app does its thing?

I've set urls.py to capture the correct url:

url( r'^foo/bar/$', view_wrapper, name='my_wrapper'),

I've created my custom view:

from 3rd_party_app.views import view2wrap

def view_wrapper(request, *args, **kwargs):
    # Do some cool custom stuff
    return view2wrap(request, *args, **kwargs)

When I try this, I get the error "No module named 3rd_party_app.views". Why?

+3  A: 

The third party application is not in your python path.

Till Backhaus
But it's in my site-packages directory and I only have a problem with it when I try to wrap the view, if I don't it works fine.
mitchf
could you be more specific? what is installed where? what is your pythonpath? what happens if you don't try to call the view?
Till Backhaus
A: 

Is the 3rd Party App listed in INSTALLED_APPS in your settings.py?

Justin Myles Holmes
Yes, it is.....
mitchf
A: 

Try placing the 3rd party package folder within your project folder. :)

RadiantHex
I actually tried that and it still didn't work! Somehow, someway after so much tinkering it is working now. Unfortunately I don't know which change was the kicker.
mitchf