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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:41:10+00:00 2026-06-13T08:41:10+00:00

I want to know how do i limit the access of specific users to

  • 0

I want to know how do i limit the access of specific users to only one page once they’re logged in.

I have in my User model

deactivated = models.BooleanField(default=False)

If the user is logged in and their account is deactivated I want to only show them a deactivation page. I don’t want to allow them to go anywhere else on the website unless they activate their account again.
What’s the best and the most simple way to implement that?

EDIT: I can’t afford going through every view I have and attach a decorator to it.

  • 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-13T08:41:11+00:00Added an answer on June 13, 2026 at 8:41 am

    If you don’t want to use the decorator approach, your best bet is to write a middleware that checks if request.user is activated or not, then redirect (to a page where they can reactivate their account preferably) when necessary.

    Roughly you’d want something like this:

    from django.shortcuts import redirect
    
    
    class DeactivatedRedirectMiddleware(object):
    
        def process_request(self, request):
            if request.user and not request.user.is_anonymous():
                if request.user.deactivated and request.get_full_path() != '/some/url/':
                    # redirect here
                    return redirect('/some/url/')
            # ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

does anybody know of a secure 'read-once' local file access system? Or how one
I just want to know do we have any concept access specifiers like private
I have a transfer function, let's say G=1/(1+s*0.23) and want to know the limit
i want know if is possible, to get a specific element value of a
I have an android app it displays web view.I want know the app idle
I'm new to sqlite. I want to know the maximum size limit of varchar
I use jena TDB to store my ontology, and I want to limit access
I want to know the size limit of data which can be fetched in
I want to limit access to files in Apache. A list of restricted files
I have a variable I want to access in my application.html.erb so it is

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.