Re: Management command scheduling options

2023-10-23 Thread Ahmedrufai Otuoze
Hi Mike,

I've implemented something similar to what you mentioned lately. I used
this Python package called APScheduler to schedule and run database
intensive queries behind the scene and then cache the result for my users
to fetch from making their experience super fast.

The APScheduler can be configured to run at any interval daily, weekly,
monthly or any customized interval you require. It's a game changer and a
quick win for Windows based OS as they don't support the use of Celery or
any other Linux based schedulers without WSL.

Do let me know if you're interested in my implementation, I'm open to show
you.

Regards

On Mon, Oct 23, 2023, 11:09 AM Mike Dewhirst  wrote:

> Django docs suggest cron or Windows scheduler for running management
> commands.
>
> I would like instead to build an internal Django based scheduler - because
> after migrating to a new server, setting up the new cron task will be
> forgotten.
>
> Is there a daily (approximately) event in a Django project I can hook into
> and test the date?
>
> The task is somewhat database intensive and needs to run quarterly for
> some users, monthly for most and weekly for others depending on their
> preferences.
>
> Ideas anyone?
>
> Thanks
>
> Mike
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Your
> email software can handle signing.
>
> --
> 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/7b29b24b-64f0-4f93-9a43-5d8f5e242b57%40dewhirst.com.au
> 
> .
>

-- 
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/CAA50JbfV1VXkpeoXLEcsOp2j0WeXM5dfKH9BbQKLAeipnOhvsQ%40mail.gmail.com.


Re: Calculated Fields

2022-04-21 Thread Ahmedrufai Otuoze
My bad. I bypassed your message completely.

Have a great day!

On Wed, 13 Apr 2022 at 18:32, Kasper Laudrup  wrote:

> On 13/04/2022 16.51, Ahmedrufai Otuoze wrote:
> > This is not a spam. I just tok a course on that aspect and wanted to
> help.
> > No strings attached.
> >
> > I may have gone against the policy and that's because I wasn't aware.
> > My intentions were genuine...
> >
>
> You were not the one I was replying to so I don't understand why you are
> replying like you were advertising this.
>
> Harsh Jain has previously been spamming this mailing list and he's the
> one I was replying to.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/8f8efa76-713f-86c8-ed18-188482af2882%40stacktrace.dk
> .
>

-- 
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/CAA50Jbdy0HQrQhXNRk1o0KiCHHddGhYwSqX4zbBdRx3_%3D3s_1g%40mail.gmail.com.


Re: Calculated Fields

2022-04-13 Thread Ahmedrufai Otuoze
This is not a spam. I just tok a course on that aspect and wanted to help.
No strings attached.

I may have gone against the policy and that's because I wasn't aware.
My intentions were genuine...

On Wed, 13 Apr 2022 at 12:08, Kasper Laudrup  wrote:

> On 13/04/2022 07.20, harsh jain wrote:
> > Hi,
> > This course will help you surely - https://geekster.in/
> >
>
> Stop spamming. This is *not* the way to attract potential clients.
>
> I would never ever consider using your company for anything and I hope
> others feel the same.
>
> --
> 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/f4ac9610-cb05-21a0-ade5-260573bddb9e%40stacktrace.dk
> .
>

-- 
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/CAA50JbdP%2Bx%3DYDtK1m5%2BhBXh798Lw-CwWd8rbR4xYS8_BJ38Ysg%40mail.gmail.com.


Re: Calculated Fields

2022-04-11 Thread Ahmedrufai Otuoze
Hi Mike,

I can help you solve the problems.
I can clone it from your repo and we'll work on it...

What do you think?

On Sun, Apr 10, 2022, 11:56 PM Mike Dewhirst  wrote:

>
>
>
>
> --
> (Unsigned mail from my phone)
>
>
>
>  Original message 
> From: tech george 
> Date: 11/4/22 03:50 (GMT+10:00)
> To: django-users@googlegroups.com
> Subject: Calculated Fields
>
> Hello,
>
> I am trying to calculate fields directly from a model but no luck. I want
> to get total_price from quantity, reoder_level and unit price. My code is
> abelow, Please advise.
>
> class Stock(models.Model):
> unit_price = models.DecimalField(max_digits=10, decimal_places=2,
> default='0', blank=True, null=True)
> quantity = models.IntegerField(default='0', blank=True, null=True)
> total_price = models.DecimalField(max_digits=10,
> decimal_places=2,default=1)
> reorder_level = models.IntegerField(default='0', blank=True, null=True)
>
>
> def save(self, *args, **kwargs):
> self.total_price = self.quantity + self.reorder_level *
> self.unit_price
> super(Stock, self).save(*args, **kwargs)
>
>
> What am i my doing wrong
>
> If it was my code, I would extract the calculation into a model method and
> call it from the save method as you are doing.
>
> That would make it easier to unit-test and perhaps discover that there
> should be parens around the addition.
>
> You also need to call save on your model to execute the code.
>
> Apart from that, at first glance your code should work.
>
>
>
> Regards,
>
> --
> 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/CADYG20HBcMMGq6QodO0v%2BeZVmfS%2Bmr4aCSro5FZeeRLFdQztnQ%40mail.gmail.com
> 
> .
>
> --
> 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/6253606d.1c69fb81.ac7f2.09bcSMTPIN_ADDED_MISSING%40gmr-mx.google.com
> 
> .
>

-- 
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/CAA50JbfaKcO55otZ1gg_0hh6ZW_iSFEiTjy5Q86bA69GKEQTKA%40mail.gmail.com.