views:

25

answers:

2

hi,

I'm doing a form application (similar to django-contact-form) and would like to be able to insert the rendered form in a Django template of another application. What's the best way to do that? Should I create a template for the form (with for example only {{ form.as_p)? If so how can I insert it in another template?

Thanks

Jul

A: 

Couldn't you load the application with the form you need in the settings.py file under INSTALLED_APPS and then call it from your template somehow? I'm a little new to django, but from what I can tell that seems like it would be the "django" way of doing it.

Bryan Ross
Have you got any pointer on how to do that?
jul
Add the path to the application to sys.path (`sys.path.append(appfoldeR)`), then put the app name in INSTALLED_APPS. Do both in settings.py
Bryan Ross
+1  A: 

What do you mean when you say a separate 'application'? Do you mean a completely separate Django site, or just a separate app within your current site?

If the latter, there's no issue: just import the form into the view you want to use it in.

If the former, then there isn't really any good way to do it. You could try using an iframe within your template to point to the external site, but it's not a particularly nice architecture.

Daniel Roseman