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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:36:56+00:00 2026-05-28T13:36:56+00:00

My question, how to override model manager’s method for passing default parameter, if it

  • 0

My question, how to override model manager’s method for passing default parameter, if it doesn’t set explicitly?

Say i have a model Entry:

class Entry(models.Model):

    user = models.ForeignKey(User, verbose_name=_("user"))
    text = models.CharField(max_length=200)
    date = models.DateTimeField(auto_now_add=True)
    deleted = models.BooleanField(default=False)

Now somehow i want in all get() and filter() methods add parameter deleted=False if this parameter isn’t set explicitly (i mean in stuff like Entry.objects.filter(deleted=True) default parameter shouldn’t override presented one).

What i do is create EntryManager and set it as manager in Entry model.
filter() method in EntreManager:

def filter(self, *args, **kwargs):
    deleted = kwargs.get('deleted', False)
    kwargs.update({'deleted':deleted})
    return super(EntryManager, self).get(*args, **kwargs)

But it doesn’t work for case deleted__in=(True, False), and it’s not strange but i don’t know ways how to do this right.
Thanks in advance.
By the way i use django 1.3.1

  • 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-28T13:36:56+00:00Added an answer on May 28, 2026 at 1:36 pm

    You should override the manager’s get_query_set method, as described here. In your case, you could do something like this:

    def get_query_set(self):
        return super(EntryManager, self).get_query_set().filter(deleted=False)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model with 3 properties, as I mentioned in a previous question
Pretty simple question. I have a model that has a property which is a
The problem is the default User model does not have some very useful options
Consider I have defined the following models: class Tag(models.Model): name = models.CharField(max_length=20) class Entry(models.Model):
The basic question is: How do I perform a basic override of a plugin
I have an entity model that has audit information on every table (50+ tables)
I got a model like this: public class MainModel { public string Id {get;set;}
I have a question regarding Wicket's Datatable. I am currently using DataTable to display
In the world of MVC I have this view model... public class MyViewModel{ [Required]
Sorry for some crazy subj. I'd like to override django models save method 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.