You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi!
So, there is a huge Django app with multiple classes in Model. I am interested in getting call stacks of some classes. I have few questions in the approach and few questions regarding the implementation. I am using Django 1.4.20 and python 2.7
1. What if we decide to write a decorator for the class/ methods? Ex.
@trackitdown Class A(models.Model):
or
@trackitdown
def some_method():# method in models.py
This is because I do not want to disturb the existing code. I wish to achieve following- I. If it is a class, track all "calls" whenever QuerySetAPI methods, save, delete is called. II. while doing following-
this should be decorator's task. III. override using get_query_set() , and save(), delete()
How do you see this approach? I obviously was not able to implement this because of peculiar behavior of Model and ModelBase.
2. Is it okay to decorate a class, define decorator as a class and override methods in it? How much is this encouraged?
3. If I use Mixins, and try to implement the same, I still do not get how do we override
objects=classWhichIsAManager()
outside the model class? that too without loosing attributes of original model class.
4. Having said this, I wish to implement a library which will take care calls stacks of model classes/ methods.
Is there a fundamental flaw in my approach? I can see that I am trying to play with some unknown business of ModelBase(Foreign Key constraints, etc) New approaches and comments are equally welcome!