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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:27:54+00:00 2026-06-12T10:27:54+00:00

I have the following ModelAdmin: class EventAdmin(admin.ModelAdmin): # ModelAdmin config def queryset(self, request): queryset

  • 0

I have the following ModelAdmin:

class EventAdmin(admin.ModelAdmin):
    # ModelAdmin config

    def queryset(self, request):
        queryset = super(EventAdmin, self).queryset(request)
        return queryset.exclude(date_end__lt=date.today())

admin.site.register(Event, EventAdmin)

Now I want to add a model to manage archived (older than today) events.

class EventArchiveAdmin(admin.ModelAdmin):
    # ModelAdmin config

    def queryset(self, request):
        queryset = super(EventArchiveAdmin, self).queryset(request)
        return queryset.filter(date_end__lt=date.today())

admin.site.register(Event, EventArchiveAdmin)

But if I try to do so I get AlreadyRegistered exception.

Why can’t I implement another ModelAdmin with same Model and how can I get different admin views of the same model?

I know I can implement a custom list_filter in my class but I’d like to keep things separated in different pages.

  • 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-12T10:27:55+00:00Added an answer on June 12, 2026 at 10:27 am

    Use proxy models:

    class Event(db.Model):
         ...
    
    class ActiveEventManager(models.Manager):
        def get_queryset(self):
            return super(ActiveEventManager, self).get_queryset().filter(active=True)
    
    class ActiveEvent(Event):
        class Meta:
            proxy = True
    
        objects = ActiveEventManager()
    
    class ArchiveEventManager(models.Manager):
        def get_queryset(self):
            return super(ArchiveEventManager, self).get_queryset().filter(active=False)
    
    
    class ArchiveEvent(Event):
        class Meta:
            proxy = True
    
        objects = ArchiveEventManager()
    

    Now, you can register 2 models without override ModelAdmin.queryset method:

    class EventAdmin(admin.ModelAdmin):
        # ModelAdmin config
    
    admin.site.register(ActiveEvent, EventAdmin)
    admin.site.register(ArchiveEvent, EventAdmin)
    

    You can read mode about proxy models and managers in the doc.

    Also, use this:

    queryset = super(EventArchiveAdmin, self).queryset(request)
    

    As first argument super() take current class. See doc

    Note: django has renamed Manager.get_query_set to Manager.get_queryset in django==1.7.

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

Sidebar

Related Questions

I have the following in models.py: class Choices(models.Model): description = models.CharField(max_length=300) def __unicode__(self): return
I have the following in admin.py class AdInline(admin.StackedInline): model = Ad class UnitAdmin(admin.ModelAdmin): fields
I have the following defined: class AnswerChoiceInline(admin.TabularInline): model = AnswerChoice # extra = 0
I have the following code: class TelefoneIPInline(admin.StackedInline): model = MovimentoTelefoneIP extra = 1 list_filter
I have a django model as following class Project(models.Model) name=models.CharField(max_length=200) class Application(models.Model) proj=models.ForeignKey(Project, null=True,
I have the following models in Django 1.3: class A(models.Model): # fields class RelatedToA(models.Model):
In a django application I have the following model: class Appointment(models.Model): #some other fields
i have following route in route.php in codeigniter $route['^(?!login|signup|autos|jobs|jobwanted|admin).*'] = pages/bpages; it is redirecting
i have following html structure. <p class=expandableContent ><span class=label>Computer and Laptop Repairs</span></p> <div style=clear:
I have the following two models class ModelOne(models.Model): mod_desc = models.CharField(max_length=25) is_active = models.BooleanField(default=True)

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.