Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:07:53+00:00 2026-06-13T13:07:53+00:00

How to call a view in my layout (template) ? For example : I’ve

  • 0

How to call a view in my layout (template) ?

For example : I’ve a form on every pages of my website. I need to generate CSRF token for each pages but I don’t want to put the generation code on every view.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:07:54+00:00Added an answer on June 13, 2026 at 1:07 pm

    In Django, once you reach the template, I don’t believe you can call something to the effect of Zend’s Action Helper.
    Obviously, you could do an AJAX call to an exposed url in Django and retrieve the necessary data. In that case you can provide the csrf token to the ajax calls as follows..

    $.ajaxSetup({data: {csrfmiddlewaretoken: '{{ csrf_token }}' },});
    

    I’m not a hundred percent sure but you can implement something like Zend’s Action Helper in a decorator (which could be applied to multiple views of your choice before processing the request) or in a context processor (which is applied to all views’ processed request).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call my XML layout file in a class that extends view.
I have a layout view, inside the layout view I call @Html.Action(ToolBarAction, ToolBarController) Inside
I want to include a Partial View in my Shared Layout template. This Partial
I'm trying to return a JSON response from a Django view call via an
I implemented 4 views in AppDelegate depends on requirement it will call the view.I
I was wondering when to call from the view a Custom View Helper like
I am developing an application that currently has a View Controller (call it ViewControllerX).
hello how can i call in the current view, a method implemented in the
How to call codeigniter controller function from view? When i call the function in
In a view, let's call it firstView I created a secondView as follows and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.