Hi Tega, 

Nice to meet you and apologies for the delay in getting back to you, 

Signals are both the best and worst. Yes, they'd "solve" this problem. 
Though so would overriding the model's save method or the admin's save 
method.

But the issue I find with them is that because they are decoupled from the 
model in a year, or the next dev, someone won't have a clue why an email is 
being sent or how to troubleshoot it.

My general guideline for using them is as a last resort. They are the lazy 
way of solving problems but will almost always cause different problems in 
the future.

Also you now have to be keenly aware of the circumstances where signals 
don't fire, also signals in my case will block the thread as the number of 
subscribers is big, 

Please let me know if you have different point of view, i am not dismissing 
any opinions


the management command is already written by another developer and i am 
trying to leave as few footprint in the code as I can, I am not even sure

if it is the right way to go about this. 

Will let you know how it pans out if you want.


Kind regards

Aziz Meknassi

On Thursday, October 20, 2022 at 5:30:21 PM UTC+1 justt...@gmail.com wrote:

> The name's Tega,
>
> If I may ask you, what makes you favour making a management command as 
> opposed to creating a simple post_save signal in your present situation.
>
> From the django documentation, post_save is literally called on every 
> save, something similar to the Publisher Subscriber pattern.
>
> I'd really appreciate your response on this.
>
> Regards,
> Tega Ukavwe
> Python Like English
>
> On Thu, Oct 20, 2022 at 5:06 PM Aziz Mek <azi...@gmail.com> wrote:
>
>> Hi All,
>>
>> I was wondering  if you have come across the following:
>>
>> I have a field in the model that's empty, when the user fills it up and 
>> clicks Save, it
>> should trigger/call a management Command (This command is already build 
>> that sends emails ), Django docs say i can use call_command but not sure 
>> how to implement it with the save
>>
>> I am just after the trigger really when the save takes place
>>
>> Many thanks in advance
>>
>> Kind regards
>> Aziz
>>
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a0ca69f0-6065-4b86-a977-cfb6dcab8fd7n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/a0ca69f0-6065-4b86-a977-cfb6dcab8fd7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac2cb103-5f51-47bf-9fc7-a949bcd6d312n%40googlegroups.com.

Reply via email to