Changes between Initial Version and Version 1 of Ticket #23533, comment 7


Ignore:
Timestamp:
Nov 27, 2025, 4:55:42 AM (3 weeks ago)
Author:
Mariusz Felisiak

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23533, comment 7

    initial v1  
    11I've created a surprisingly small PoC that works for me. Simon, Can you take a look?
     2
     3I've tried it with the following model:
     4{{{#!python
     5from django.db import models
     6
     7# Create your models here.
     8
     9class MyModelQuerySet(models.QuerySet):
     10    pass
     11
     12
     13class MyModel(models.Model):
     14    name = models.TextField()
     15    active = models.BooleanField(default=False)
     16    code = models.CharField(max_length=255, default="X")
     17   
     18   
     19    active_objects = MyModelQuerySet.filter(active=True).as_manager()
     20    nonactive_objects = MyModelQuerySet.filter(active=False, code="X").as_manager()
     21}}}
Back to Top