Re: htmx progress indicator problem - might be caching

2023-11-29 Thread Mike Dewhirst

On 29/11/2023 9:56 pm, Thomas Couch wrote:

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:
  



It all seems OK to my untrained eye and things stop working if I play 
with those elements. I'll take them out later and resort to css for 
positioning once it is all working. I didn't know div inside a p was wrong.






Another thing is, it doesn't look like there's anything linking the 
submit button click to the initial htmx


You are right. That button is in an unbound Django forms.Form and submit 
triggers the database processing - which is all working fine returning 
correct results.


As an enhancement I tried to detect something else to trigger htmx for a 
progress indicator.




request, and there's no htmx in the response.


The response is either a downloaded .csv file or a table of comma 
separated values for the user to copy and paste into a spreadsheet - 
depending on whether the input was pasted into a text field or uploaded 
as a file (list or csv).


Sadly, the response doesn't return until the processing is complete. So 
it cannot kick off a progress bar.


Perhaps I need to embark on the async ship? That's a strange land for me.


Have you tried replicating the progress bar example?
https://htmx.org/examples/progress-bar/


I looked at that and felt it was too heavily contrived generating time 
increments to expand the bar across the page. It didn't seem the right 
place to start.


If I was going to use it (and I would/will) I first need to obtain 
progress numbers based on my incrementing count as records are created 
in the database. I can easily put them into the user instance. That 
works well within the main view called by the submit button as indicated 
by print statements as it loops.


I cannot find a way to get the incrementing number across into the htmx 
view even though it is the same user in the hx-request - as indicated by 
a print statement.


In breaking news, I have tried to get a spinner going to amuse the user 
while database records are being created. Not properly successful. It 
does start spinning if I click the submit button a second time but that 
is less than satisfactory. I have to experiment after studying the htmx 
docs some more.


Here is the current form html ... you can see if there IS a result, the 
waiting is over and I use htmx to stop the spinner.




    {% csrf_token %}

    {% if form.non_field_errors %}

    {{ form.non_field_errors }}

    {% endif %}

    

    

    {% for field in form %}

    

     

    {{ field }}

    

    {% if field.help_text %}

    

    {{ field.help_text }}

    

    {% endif %}

    {% endfor %}

    

     

    

    {% if not result %}

  

  

  

    hx-trigger="click">


  

    

  

  

    {% else %}

   

  

  

    hx-trigger="every 1s">


   

  

  

    {% endif %}

    

    

    

    







{{ result }}




So I have two problems: One is getting the numbers to animate a progress 
bar and two is triggering htmx in parallel with the submit button click.


Many thanks for taking an interest.

Cheers

Mike




On Tuesday, November 28, 2023 at 2:26:20 AM UTC Mike Dewhirst wrote:

I'm trying but failing to get htmx to deliver a progress indication.

The task is creating records in the database for each item in a
list provided by the logged in user.

The view with the submit button collects the list and does the
database insertion. I added a "progress" property to the User
model as follows ...

class User(AbstractUser):

     def __init__(self, *args, **kwargs):

     super().__init__(*args, **kwargs)

     self.progress = ""

     ...

     def set_progress(self, value):

     self.progress = value

     @property

     def get_progress(self):

     return f"{self.progress}"

     ...



In the view I update user.progress with the record insertion
counter and get_progress returns the correct value in the view
itself as proven by print statements. So that part is working.

In the template, I have ...

   

     

   

   


... which in theory should fetch progress every second if the htmx
docs are correct. See https://htmx.org/docs/#polling

This is the htmx view ...

def hx_usr_progress(request):

     progress = request.user.progress

     print(f"\n{progress} ... {request.user}")

     return HttpResponse(mark_safe(f"... {progress}"))


When the import [Submit] button is clicked, the print statement in
hx_usr_progress fires with a blank progress value as per the
User.__init__() method AND on the page beneath the Submit button
the 3 dots shown above i

Re: Displaying numbers in languages

2023-11-29 Thread Vincenzo Celano
Ciao
אורי
In italian  language, thousand separator is the dot '*.*' and comma '*,*'
for decimal separator.
I think the problem is not important in this case but for example, if you
have a car sales website and an italian will find a Ford Mustang Mutch-E at
this prince:
60,865 $ an italian person will read 60 $ and 8 hundred and 65 cents not 60
thousands and 8 hundred and 45 $
:-)

I hope this will be helpful.

Ciao!

‪Il giorno mer 29 nov 2023 alle ore 05:00 ‫אורי‬‎  ha
scritto:‬

> Hi,
>
> Since Speedy Match was only in English, I displayed numbers in the English
> format - with commas as thousand separators. For example today it writes:
>
> The total number of active members on the site is 12,221, of which 2,581
> members entered the site in the last week.
>
> Now, I translated Speedy Match into other languages, such as French,
> German, Spanish, Portuguese and Italian. In these languages I still use the
> same number formatting as in English:
>
> Le nombre total de membres actifs sur le site est 12,221, dont 2,581
> membres entrés sur le site au cours de la dernière semaine.
>
> Die Gesamtzahl der aktiven Mitglieder auf der Website beträgt 12,221, von
> denen 2,581 Mitglieder die Website in der letzten Woche betreten haben.
>
> Is it better to use formats.number_format and display the numbers in each
> language differently? Or is it OK to keep it this way? I’m specifically
> asking people who speak languages such as French, German, Spanish,
> Portuguese, Italian and Dutch. How important it is to change the thousand
> separators?
>
> Thanks,
> Uri.
> אורי
> u...@speedy.net
>
> --
> 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/CABD5YeEBFAJK_v4er294-GDqLrRFOsiS1bY1rxmdQve3PNXcig%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/CAB5pmX--ho5uXL6w3T1WNcy2swwk_QPHRnhtqPGatrysWwZs%2BQ%40mail.gmail.com.


Re: htmx progress indicator problem - might be caching

2023-11-29 Thread ELVIS MAKASI
Greas

Le mer. 29 nov. 2023, 11:57, Thomas Couch  a écrit :

> 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 tried replicating the progress bar example?
> https://htmx.org/examples/progress-bar/
>
>
> On Tuesday, November 28, 2023 at 2:26:20 AM UTC Mike Dewhirst wrote:
>
>> I'm trying but failing to get htmx to deliver a progress indication.
>>
>> The task is creating records in the database for each item in a list
>> provided by the logged in user.
>>
>> The view with the submit button collects the list and does the database
>> insertion. I added a "progress" property to the User model as follows ...
>>
>> class User(AbstractUser):
>>
>>
>> def __init__(self, *args, **kwargs):
>>
>> super().__init__(*args, **kwargs)
>>
>> self.progress = ""
>>
>> ...
>>
>>
>> def set_progress(self, value):
>>
>> self.progress = value
>>
>>
>> @property
>>
>> def get_progress(self):
>>
>> return f"{self.progress}"
>>
>> ...
>>
>>
>>
>> In the view I update user.progress with the record insertion counter and
>> get_progress returns the correct value in the view itself as proven by
>> print statements. So that part is working.
>>
>> In the template, I have ...
>>
>>   
>>
>> 
>>
>>   
>>
>>   
>>
>>
>> ... which in theory should fetch progress every second if the htmx docs
>> are correct. See https://htmx.org/docs/#polling
>>
>> This is the htmx view ...
>>
>> def hx_usr_progress(request):
>>
>> progress = request.user.progress
>>
>> print(f"\n{progress} ... {request.user}")
>>
>> return HttpResponse(mark_safe(f"... {progress}"))
>>
>>
>> When the import [Submit] button is clicked, the print statement in
>> hx_usr_progress fires with a blank progress value as per the
>> User.__init__() method AND on the page beneath the Submit button the 3 dots
>> shown above in the last line of the hx_usr_progress() view but nothing
>> further even though the main view is definitely incrementing the count.
>>
>> That tells me it is being called at least once instead of every second.
>> It should have fired at least 3 or 4 times.
>>
>> Or if it did perhaps the original response is cached - I don't know.
>>
>> How can I get this ticking over?
>>
>> Thanks for any hints.
>>
>> Cheers
>>
>> Mike
>>
>> --
> 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/020a98ef-4a10-4560-afdd-0a8b065e7235n%40googlegroups.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/CACCiQ-kXKdgpS%3DCAK0ZJXrw6JO4CXVftcjpiP%3D2E3rh1NgqD3g%40mail.gmail.com.


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 tried replicating the progress bar example?
https://htmx.org/examples/progress-bar/


On Tuesday, November 28, 2023 at 2:26:20 AM UTC Mike Dewhirst wrote:

> I'm trying but failing to get htmx to deliver a progress indication.
>
> The task is creating records in the database for each item in a list 
> provided by the logged in user.
>
> The view with the submit button collects the list and does the database 
> insertion. I added a "progress" property to the User model as follows ...
>
> class User(AbstractUser):
>
>
> def __init__(self, *args, **kwargs):
>
> super().__init__(*args, **kwargs)
>
> self.progress = ""
>
> ...
>
>
> def set_progress(self, value):
>
> self.progress = value
>
>
> @property
>
> def get_progress(self):
>
> return f"{self.progress}"
>
> ...
>
> 
>
> In the view I update user.progress with the record insertion counter and 
> get_progress returns the correct value in the view itself as proven by 
> print statements. So that part is working.
>
> In the template, I have ...
>
>   
>
> 
>
>   
>
>   
>
>
> ... which in theory should fetch progress every second if the htmx docs 
> are correct. See https://htmx.org/docs/#polling
>
> This is the htmx view ...
>
> def hx_usr_progress(request):
>
> progress = request.user.progress
>
> print(f"\n{progress} ... {request.user}")
>
> return HttpResponse(mark_safe(f"... {progress}"))
>
>
> When the import [Submit] button is clicked, the print statement in 
> hx_usr_progress fires with a blank progress value as per the 
> User.__init__() method AND on the page beneath the Submit button the 3 dots 
> shown above in the last line of the hx_usr_progress() view but nothing 
> further even though the main view is definitely incrementing the count. 
>
> That tells me it is being called at least once instead of every second. It 
> should have fired at least 3 or 4 times.
>
> Or if it did perhaps the original response is cached - I don't know.
>
> How can I get this ticking over?
>
> Thanks for any hints.
>
> Cheers
>
> Mike
>
>

-- 
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/020a98ef-4a10-4560-afdd-0a8b065e7235n%40googlegroups.com.


Re: Project together

2023-11-29 Thread william Kachuma
Add me please

On Mon, Nov 27, 2023, 5:10 PM Selmane  wrote:

> im interested +213556434461
>
> On Sun, Nov 26, 2023 at 10:48 PM usman ashir <
> www.usmanashirmu...@gmail.com> wrote:
>
>> yes pls send us the group link. or pls 2348166997172.add my contact
>>
>> On Sun, Nov 26, 2023, 9:38 PM Jay Senkow  wrote:
>>
>>> interested.
>>>
>>> Sent from my iPhone
>>>
>>> On Nov 26, 2023, at 2:46 PM, ekong, emmanuel 
>>> wrote:
>>>
>>> 
>>> I am interested
>>>
>>> Phone ( WhatsApp): +234-8071-505-514
>>>
>>> On Thu, 23 Nov 2023 at 7:13 PM, Youssef Bachraoui <
>>> bachraouiyouss...@gmail.com> wrote:
>>>
 Hi developer i search to make a group on WhatsApp to begin a project
 together anyone interested about that?

 --
 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/d5244e76-6bd3-4bde-bf31-a72720bee1acn%40googlegroups.com
 
 .

>>>
>>> *Disclaimer*
>>> This e-mail is intended solely for the named recipient. The information
>>> contained in this message is strictly confidential.
>>>
>>>- If you are not the named recipient, you are hereby notified that
>>>any use, dissemination or reproduction of this document and or its 
>>> content
>>>is prohibited and may be deemed unlawful.
>>>- If you are not the named recipient of this e-mail, please notify
>>>the sender by a return e-mail and delete all copies of it from your
>>>computer and mail.
>>>
>>> Any views expressed in this e-mail are those of the individual sender,
>>> except where the sender specifically states them to be those of Landmark
>>> University , to whom no liability shall be attached
>>> whatsoever.
>>>
>>> Thank you
>>>
>>> --
>>> 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/CAAP9wczbDL6n7qW5WARHwGsR8hbVgwV0K%3DdTGJoBqE3aQc4TWA%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/ACC804A9-5EF3-4D3A-B11A-6AE171113174%40gmail.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/CAHNdQhwinzLUgaUvQNfYOnxbXhtk4shxcSn5zz00Kceiz7Zb%2Bw%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/CAJZh6jAyqT7eWL4804rmL%2BjB%3DaUWyXX_ayzLHAChCgfR96hCvQ%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/CADa4_w3WDHOx9ZQT-VAa6a7oqEyehKgqrSeokf2atoOmYhi46g%40mail.gmail.com.