I'm having trouble overriding QuerySet.none() (code below)... Works
if I rename the method to almost anything but "none".
class QuerySetManager(models.Manager):
def get_query_set(self):
return self.model.QuerySet(self.model)
def __getattr__(self, name):
return getattr(self.get_query_set(), name)
class NewNoneQuerySet(models.query.QuerySet):
def none(self):
print 'NewNone\n\n\n\n'
return self.filter(pk__in=[])
class TestNone(models.Model):
name = models.CharField(max_length=20)
objects = QuerySetManager()
class QuerySet(NewNoneQuerySet):
pass
TestNone.objects.none()
No output of 'NewNone\n\n\n\n'... Using the inherited method in other
tests... Is there something special about the none method?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment