WillF wrote: > > > > David Durham, Jr. wrote: >> >> On Wed, Sep 17, 2008 at 1:35 PM, WillF <[EMAIL PROTECTED]> wrote: >>> I have written a login view as I have followed the tutorial but how do I >>> reuse this view in multiple pages of the site? >>> >>> Is there a way to render this particular view as part of a template, so I >>> could have the login form (or anything for that matter) be displayed on >>> every single page? >> Have you read up on template inheritance? >> http://docs.djangoproject.com/en/dev/topics/templates/#id1 >> >> > > I've read that part, I can see how that would work if I statically define > the form. But right now I have > a view defined that pushes out the LoginForm to my template. So say I have > another view which populates the links dynamically... How do I incorporate > both of these with inheritance, I could have one block for login and one > block for links, but then how do the Login and Links views (where I'm > passing the forms) fit into this picture? > > Perhaps I'm missing something.
If I understand you correctly... I don't think there's anything that automerges your forms. You have to do it by "hand". If two forms need the same logic I put that in it's own function and then call that function from each of the views. function add_links_to_context(context): magical_stuff function links_only_view(request): context = RequestContext() add_links_to_context(context) render_to_response(... function links_n_form(request): context = RequestContext() # action of this form points to handle_form view context["form"] = MyForm() add_links_to_context(context) render_to_response(... function handle_form(request, where_to_redirect_to): form handling logic here HttpRedirect(where_to_redirect_to) -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman ___________________________________________________________________________ Get off the sidelines and huddle up with the Statesman all season long for complete high school, college and pro coverage in print and online! --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---