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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:16:49+00:00 2026-05-23T01:16:49+00:00

I am trying to create an application in which users are locked out from

  • 0

I am trying to create an application in which users are locked out from logging in due to too many failed login attempts.

To this end, if there are 5 failed logins within 5 minutes, a Lockout object is created, and the user is deactivated (is_active=False).

However, when this Lockout object is deleted, the user should be immediately made active again (is_active=True).

To do this, I must override the delete() function for the Lockout model so as to activate the user upon deletion. This code, which I think follows documentation, isn’t working:

def delete(self):
        self.user.is_active = True
        self.user.save()
        super(Lockout, self).delete()

I was wondering if this was the proper way to do this?

Thanks a lot.

  • 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-23T01:16:49+00:00Added an answer on May 23, 2026 at 1:16 am

    That’s the correct way to do it. The problem you’re having is that you’re trying to delete via a QuerySet, which does not invoke the model methods. You will need to .filter(), then iterate through it calling .delete() on each model.

    But it would probably be easier to create a new auth backend that checked for a lockout instead of going through these acrobatics.

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

Sidebar

Related Questions

I am trying to create a simple console based java application, which requires users
I'm trying to create an iOS application which upon loading, will initially connect via
I am trying to add a page to my application which will show a
I am trying to create a WPF application that will be a central point
I'm trying to set up security for my application for users. I am not
I am in the process of creating an application which will communicate with a
I created a Ruby on Rails application (2.3.9) where users can record workouts. I
I am currently working on an ASP.NET application in VB.NET and one of its
I am working on a web application that store a lot of measurement data.
I created a custom membership provider and am getting the following error trying to

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.