martinsam
3/5/2014 - 9:58 AM

Chainer les requêtes Django

from datetime import datetime
from django.db.models import Manager
from django.db.models.query import QuerySet
    
    class TodoMixin(object):
        def is_done(self):
            return self.filter(done=is_true))
            #ecrire ici vos nouvelles méthodes
    
    class  TodoQuerySet(QuerySet, PostMixin):
        pass
    
    class  TodoManager(Manager,  TodoMixin):
        def get_query_set(self):
            return TodoQuerySet(self.model, using=self._db)
    
    class Todo(models.Model):
        done = models.BooleanField()
        objects = PostManager()