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 6781895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:40:39+00:00 2026-05-26T16:40:39+00:00

I have a view for logout,now I wanna when user click on an anchor

  • 0

I have a view for logout,now I wanna when user click on an anchor link the logout view run,how can I do this?
in views.py:

def logout(request):
   auth.logout(request)
   return render_to_response("airAgency/index.html")  
  • 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-05-26T16:40:40+00:00Added an answer on May 26, 2026 at 4:40 pm

    I’m new in django,I can submit a form and run a view for that, but I
    don’t now what should I do to run s.th like logout view when clicking
    an anchor link.

    Logging out via a link instead of a form is easy.

    https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.logout

    from django.contrib.auth import logout
    
    def logout_view(request):
        logout(request)
        return http.HttpResponse("You've been logged out")
    

    Just point a url to this view like you did with your form and go to that URL.

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

Sidebar

Related Questions

in views.py I have this: def logout(request,key): auth.logout(request) return HttpResponseRedirect(reverse('airAgency.views.index',args=[key])) in index template i
i have view like 'home/details/5', it can be access by anonymous user. but there
I have a login form (/user). And methods: -authenticate -logout And one view index.html.erb,
In my view I have: <?php echo $this->Form->create('User', array(controller => Users, action => login,
i have this code: <li><a href={% url 'django.contrib.auth.views.logout' %}>Logout</a></li> <li><a href={% url 'django.contrib.auth.views.account' %}>Account</a></li>
I have a view model coming from the server as json like this {
So I have a dashboard controller that points to the corresponding view. This file
i have this file secure.php session_start(); if(empty($_SESSION['u_name'])) { header(Location:emprego.php); } if(isset($_GET['logout'])) { session_destroy(); header(Location:emprego.php);
On my website I want the user to have the ability to login/logout from
I have a view with a username, password and a submit button. This view

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.