Also, in
https://github.com/django/django/blob/master/django/db/models/manager.py#L126
Is `manager_method.__name__` name of the query set Method?

On 17 June 2015 at 13:47, Utkarsh J <jadhav.utka...@gmail.com> wrote:

> Simon,
>
> I guess that is not what I am looking for. It will print "get_query_set"
> I am more interested in getting the names of methods.
>
>
> On 17 June 2015 at 11:59, Simon Charette <charett...@gmail.com> wrote:
>
>> Hi Utkarsh,
>>
>> I guess you could define a __getattribute__[1] method on your manager?
>>
>> from django.db import models
>>
>> class MyManager(models.Manager):
>>     def __getattribute__(self, name):
>>         print(name)
>>         return super(models.Manager, self).__getattribute__(name)
>>
>> Simon
>>
>> [1]
>> https://docs.python.org/2/reference/datamodel.html?highlight=__getattribute__#object.__getattribute__
>>
>>
>> Le mercredi 17 juin 2015 11:10:08 UTC-4, Utkarsh a écrit :
>>>
>>>
>>> I am trying to log overridden calls to QuerySetAPI.  Say I am calling
>>> Example.objects.filter(id=1)and I have following code in Models.py
>>>
>>> objects = MyManager()
>>>
>>> and in MyManager I have-
>>>
>>> class MyManager(Manager):
>>>    def get_query_set(self):
>>>        # logging stuff I am doing
>>>        return super(MyManager, self).get_query_set()
>>>
>>> How do I get the method name such as filter,all,get_or_create_object
>>> (i.e. filter here) in MyManager->get_query_set()? Is there a way to do
>>> that without using inspect stack()?
>>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/FwHZmQrBDu0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c3c9570a-6989-442a-b33b-08cb9a668708%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/c3c9570a-6989-442a-b33b-08cb9a668708%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Regards,
> Utkarsh J.
>
>


-- 
Regards,
Utkarsh J.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BUZR73tEVjMqDTEpfz3yhqLV%3D-vMPZnRFc%2BsEp3eq0NT2KCdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to