Re: htmx progress indicator problem - might be caching

2023-12-01 Thread Thomas Couch
each item. That'll allow your initial htmx post to return without being blocked. The htmx endpoint for the progress bar can then check completed count for the task group. On Thursday, November 30, 2023 at 3:42:39 AM UTC Mike Dewhirst wrote: > On 29/11/2023 9:56 pm, Thomas Couch wrote: &g

Re: htmx progress indicator problem - might be caching

2023-11-29 Thread Thomas Couch
Not sure if it's related, but you've got a div inside a p element there: That'll probably get corrected by the browser to: Another thing is, it doesn't look like there's anything linking the submit button click to the initial htmx request, and there's no htmx in the response. Have you trie

Re: Simple Ajax Search

2023-11-23 Thread Thomas Couch
I think Select2 is a well trodden path for this sort of thing (unless I'm mistaken, it's already available in the admin interface). Have a look at the django-select2 package: https://django-select2.readthedocs.io/en/latest/ On Thursday, November 23, 2023 at 12:36:23 PM UTC lone...@gmail.com wrot

Re: Calculations

2023-07-10 Thread Thomas Couch
; I have tried but I got that error message > > On Fri, Jul 7, 2023 at 5:03 PM Thomas Couch wrote: > >> Hi Abdou, have a look at aggregation ( >> https://docs.djangoproject.com/en/4.2/topics/db/aggregation/) >> >> In this case I think you'll want something lik

Re: Calculations

2023-07-07 Thread Thomas Couch
Or, you can combine annotations and expressions to do something like this: qs = LoanInformation.objects.annotate(outstanding=F("amount_to_pay") - Func(F("payments__amount"), function="SUM)) loan = qs.get(id=loan_id) loan.outstanding On Friday, July 7, 2023 at 4:03:09 PM

Re: Calculations

2023-07-07 Thread Thomas Couch
Hi Abdou, have a look at aggregation (https://docs.djangoproject.com/en/4.2/topics/db/aggregation/) In this case I think you'll want something like: ``` from django.db.models import Sum # Where loan = the LoanInformation instance you're interested in outstanding_balance = loan.amount_to_pay -

Re: Negative Stock Prevention

2022-08-30 Thread Thomas Couch
I don't see where you define the quantity variable, should that be instance.quantity? Also, presumably you want to check if quantity is greater than or equal to qu rather than 0. Try changing `if quantity > 0` to `if instance.quantity >= qu` On Tuesday, August 30, 2022 at 3:44:51 PM UTC+1 Ryan