'How to execute custom function when I'm clicking on object in django admin?
I want to create function, that will be execute every time when Admin click on this object in Django Admin. Do you have some ideas?
My function is trivial, I have just override save, but I want to execute this function without saving object:
def save(self, *args, **kwargs):
if self.corp_goal:
print('We have corporate goal!')
for i in self.corp_goal.all():
if i.corp_factor_rate:
print('we have rated goal!')
print('Corporate goal {} : factor {}'.format(i.corp_goal_title, i.corp_factor_rate * i.corp_factor_weight))
else:
print('we dont have rated goal')
else:
print('we dont have asigned goals')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
