On Sat, Oct 6, 2012 at 3:14 AM, Amirouche <amirouche.boube...@gmail.com> wrote: > Héllo, > > I got a problem with manager, some of you may already know it, I try my best > to like them, if anyone can explain me the purpose of their existence I will > be so much grateful :) > > Like I said, I try my best but: > > 0) Documentation references «default_manager», but I don't find it in the > code, is it a documentation bug ?
I don't think it's a bug, but I agree there is some mental gymnastics that needs to happen. I remember the same. The default manager is usually the "objects" in MyModel.objects.all(). But if you add new managers, the TOP manager is the default manager - as a result, a lot of people add the objects = models.Manager() to the top of their list of managers, followed by the self defined managers. > 0bis) What is the purpose of «_default_manager» and «_base_manager» ? Riffing from the top of my head, (ie, I don't know exact motivations, but am pretty sure it's) that managers are integral to data use. ie, the base_manager is the class in the code that gives us the managers, and the default manager is the standard out of the box manager. Base exists so that managers can be extended. Look at your code. How often do you use MyModel.objects.all() or MyModel.objects.filter(x=y) or anything like that at all? That's all Managers. This is why we need managers - so that we don't have to write SELECT * FROM TABLENAME WHERE X=Y (or whatever the SQL is) I wish I could answer the rest of your questions, but I'm only new to Django too :) cheers L. > 1) What is the purpose of «Manager.db», it's not used in Manager class, so I > don't think it's used anywhere else > > 2) Polymorphism > > Is there anyone that can debug two level and more of inheritance in > Django-Polymorphic > I think this a revision of Django Polymorphic that works with that problem, > anyone knows the revision hash ? > Do you know any other application that does polymorphism the way I need it > (with several level of inheritance) ? > > If they are answers to question 2, I might no need the answer to the > following questions, I still would like to know. > > I have the following models, manager and querysets > https://gist.github.com/3826531 > > According to the code of Manager in manager.py, I just need to override > «get_query_set», but here is what I get as results, the bug is in the second > line: > >> In [14]: PolymorphicQuerySet(Entry) >> Out[14]: [<Entry: foo>, <Article: bar>, <Article: bar>, <Article: bar>, >> <Article: bar>, <Article: bar>, <Article: bar>] >> In [15]: Entry.objects.all() >> Out[15]: [] > > > What am I doing wrong ? > > Thanks, > > > Amirouche > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/G20heNLwu6IJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- ...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, “We look at the present through a rear-view mirror. We march backwards into the future.” http://www.warrenellis.com/?p=14314 -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.