2👍
✅
In the end they’ll both work. However, over time, you may find that do_it_all
becomes quite big and you’ll end up splitting it into multiple functions anyway:
@receiver(some_signal)
def do_it_all(sender, **kwargs):
do_something_for_table_one(sender, **kwargs)
do_something_for_table_two(sender, **kwargs)
do_something_for_table_three(sender, **kwargs)
In that case it’s not really different from option two.
So I’d argue that the second approach leads to cleaner code in the end. It also means you can test each receiver separately.
Source:stackexchange.com