Re: Django call_command from Admin

2022-10-20 Thread Muhammad Juwaini Abdul Rahman
https://docs.djangoproject.com/en/4.1/ref/django-admin/#running-management-commands-from-your-code I think it's quite straightforward. Just add call_command(command) after (or before the save() line) in your code. Depending on whether you're using FBV or CBV, you need to pinpoint where exactly

Re: Django call_command from Admin

2022-10-20 Thread Aziz Mek
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

Re: How to get superuser access to bypass payments page

2022-10-20 Thread Gabriel Araya Garcia
In template you should put an conditional, if it is an any user then show the real price and if it's a superuser then show zero. And on the back-end you should ask the same question at the time to save. gabrielaraya2...@gmail.com Regards Gabriel Araya Garcia GMI - Desarrollo de Sistemas

How to get superuser access to bypass payments page

2022-10-20 Thread Silver Trinity
Hello all new developer here, I am working with existing code base and want to fix an issue in the system. Here is the problem: When a superuser logs into the site and selects a product, he is charged and I have to implement a 100% discount to his price so he doesn't have to pay. This is

Re: Django call_command from Admin

2022-10-20 Thread Tega Ukavwe
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.

Re: Django call_command from Admin

2022-10-20 Thread Aziz Mek
Hi Thank you very much for the swift response and for the link, much appreciated. I did have a look at that article this morning but it is using signals which will only add one more layer to my stack and i think essentially does what call_command will do anyway. I really appreciate your

Re: Combining django apps

2022-10-20 Thread Aziz Mek
Hi, Both are correct and lead to the same thing, however Django documentation seems to prefer *odo.apps.TodoConfig* I hope that helps Kind regards Aziz On Wednesday, October 19, 2022 at 8:10:05 AM UTC+1 tna...@gmail.com wrote: > Also, some website says something like > > INSTALLED_APPS = [

Re: Django call_command from Admin

2022-10-20 Thread Tega Ukavwe
Do a little read up on post_save signal. Below is a link to a good start point for you: https://simpleisbetterthancomplex.com/tutorial/2016/07/28/how-to-create-django-signals.html I hope this helps you in your search. Best Wishes Aziz. On Thu, Oct 20, 2022 at 5:06 PM Aziz Mek wrote: > Hi All,

Django call_command from Admin

2022-10-20 Thread Aziz Mek
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

Re: Combining django apps

2022-10-20 Thread ASAMOAH EMMANUEL
Register all your apps in the settings.py file and ensure the namespace is set to the app name in the urls.py in the project directory On Tue, Oct 18, 2022 at 10:01 AM Jun Tanaka wrote: > > mysite/ > > manage.py > > config/ > > __init__.py > > settings.py > >