Django 4.0 released

2021-12-07 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2021/dec/07/django-40-released/

--
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/3c807ebe-ca79-c317-51e5-0859abbf8a44%40gmail.com.


Re: How to update part of a JSONField with a computed value?

2021-12-07 Thread Bazil M H
Use the inbuilt *json* library in python. Use json.dumps and json.loads
to convert the dictionary to json and vice versa.
On Thursday, 5 August 2021 at 04:17:38 UTC+5:30 shahee...@gmail.com wrote:

> Hi,
>
> I'm using Django 3.2 on Postgres12, and I have a model with a JSONField 
> which contains a simple dict (actually, a Django formset :-)). I would like 
> to update just one value in the dict. I can get this to work when the new 
> value is a hardcoded numeric 333 (quoted, as seems to be needed) like this:
>
> pay_items.update(inputs=JSONBSet('inputs', ['inputs-0-value'], 
> Value("333"), True))
>
> where JSONBSet is a Func, as indicated below. However, I'd like to 
> actually compute the value. I've tried a variety of things, without 
> success. Here is one attempt:
>
> pay_items.update(inputs=JSONBSet('inputs', ['inputs-0-value'],
>  Cast(F('inputs__inputs-0-value'), 
> FloatField()) + Value("3"),
>  True))
>
>
> This fails like this:
>
> ERROR:  function jsonb_set(jsonb, unknown, double precision, boolean) does 
> not exist at character 42 
> HINT:  No function matches the given name and argument types. You might 
> need to add explicit type casts. 
> STATEMENT:  UPDATE "paiyroll_payitem" SET "inputs" = 
> JSONB_SET("paiyroll_payitem"."inputs", '{inputs-0-value}', 
> (CAST(("paiyroll_payitem"."inputs" -> 'inputs-0-value') AS double 
> precision) + '3'), true) WHERE "paiyroll_payitem"."id" IN (...))
>
> I've tried all sorts of variants with Cast, ExpressionWrapper and so on to 
> no avail, so I'd be grateful for any shove in the right direction!
>
> Thanks, Shaheed
>
> Encls: implementation of JSONBSet derived from 
> https://code.djangoproject.com/ticket/32519 and related threads:
>
> class JSONBSet(Func):
> function = 'JSONB_SET'
> arity = 4
> output_field = CharField()
>
> def __init__(self, field, path, value, create: bool = True):
> path = Value('{{{0}}}'.format(','.join(path)))
> create = Value(create)
> super().__init__(field, path, value, create)
>
>

-- 
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/3f2eb04c-3a7f-4bf8-bdf7-7fa787b2fe18n%40googlegroups.com.


Re: Mouse movement detection and processing from client UI

2021-12-07 Thread Bazil M H
Mouse clicks are client side actions. You need javascript to get that data. 
One solution maybe capturing the mouse clicks at the client side via 
javascript and sending the data as JSON to your backend by AJAX. Just a 
suggestion. 

On Thursday, 28 October 2021 at 11:24:39 UTC+5:30 Derek wrote:

> I am not sure about the others, but certainly for map clicks you'll need 
> JavaScript  e.g.
> https://docs.mapbox.com/mapbox-gl-js/example/popup-on-click/
> Of course, the page itself, with JS code links, snippets and supporting 
> data can be generated via Django in the normal way.
>
> HTH
>
>
> On Wednesday, 27 October 2021 at 04:03:16 UTC+2 lego.th...@gmail.com 
> wrote:
>
>> So there are Python packages out there that can handle mouse movement 
>> detection locally. But for a Django app, how do we go about do this? 
>> Clearly we cannot have any processing power on the client machine. Below 
>> are some examples to be more specific:
>> 1 - An e-commerce page where buyer clicks, drags (i.e. holds the mouse) 
>> and drops a picture of an item from shelf to cart.
>> 2 - A web game where player clicks, drags and drops things from one 
>> location on the screen to another.
>> 3 - Web page responds to location of mouse on screen (i.e. coordinates) 
>> such as GPS-related apps with real map.
>>
>> Thanks,
>>
>

-- 
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/e0774e00-5904-4ca5-bd0e-ae1f8ded84f2n%40googlegroups.com.


Re: Display api in particular format

2021-12-07 Thread Bazil M H
Can you make the image an attachment ? Cant see anything on your image.

On Saturday, 27 November 2021 at 23:00:41 UTC+5:30 Sapna Agrahari wrote:

> Can anyone please help me with this? As I want to display the api data in 
> this format.
> [image: image.png]
> 
> Thanks and Regards ,
> *Sapna Agrahari*
>

-- 
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/d56792fe-3636-4dd6-bf8f-92dac0a17783n%40googlegroups.com.


Re: class based view Type error

2021-12-07 Thread Bazil M H
Have you changed the urls.py file accordingly?

On Thursday, 18 November 2021 at 09:02:55 UTC+5:30 Trippy Samurai wrote:

> Hello,
> I have my function based writted like this 
>
>
> @login_required
> def accept_tickets_view(request,pk):
> ticket = get_object_or_404(Ticket,id=pk)
> if ticket.status == 'Opened':
> ticket.status = 'Accepted'
> ticket.accepted_date = datetime.datetime.now()
> ticket.accepted_by = request.user
> ticket.save()
> return redirect(reverse('open_tickets'))
>
>
>
> And i changed the above to cbv but getting the following error how do i 
> solve this
>
> class DeveloperAcceptTicketView(LoginRequiredMixin,TemplateView):
> template_name = 'app/open_tickets.html'
> def get(self,request,pk):
> ticket = Ticket.objects.get(id=self.pk)
> if ticket.status == 'Opened':
> ticket.status = 'Accepted'
> ticket.accepted_by = self.request.user
> ticket.save()
> return render(request,self.template_name)
> [image: Screenshot 2021-11-18 at 9.01.12 AM.png]
>
>
>
>
>

-- 
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/0a08891f-027e-4a94-9b20-1e9e34f077abn%40googlegroups.com.


Re: Can't able to accept the friend request in my django website

2021-12-07 Thread Bazil M H
Please format your question correctly so that someone can understand that. 
Then only people can answer your question.

On Friday, 3 December 2021 at 05:57:22 UTC+5:30 Kasper Laudrup wrote:

> https://www.propublica.org/nerds/how-to-ask-programming-questions
>

-- 
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/3bd1bb82-cfe3-4438-a24c-dbf64b1a7ad2n%40googlegroups.com.


Re: Django 4.0 released

2021-12-07 Thread Gerardo Palazuelos Guerrero
Thank you!

—
Gerardo Palazuelos
Enviado desde mi iPhone

> El 7 dic 2021, a la(s) 2:28, Mariusz Felisiak  
> escribió:
> 
> 
> Details are available on the Django project weblog:
> 
> https://www.djangoproject.com/weblog/2021/dec/07/django-40-released/
> 
> -- 
> 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/3c807ebe-ca79-c317-51e5-0859abbf8a44%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/33847695-67F0-41D2-8BF7-73C43DC5166B%40gmail.com.


Re: Django 4.0 released

2021-12-07 Thread Noel Simela
Great stuff,

On Tue, Dec 7, 2021 at 11:28 AM Mariusz Felisiak 
wrote:

> Details are available on the Django project weblog:
>
> https://www.djangoproject.com/weblog/2021/dec/07/django-40-released/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/3c807ebe-ca79-c317-51e5-0859abbf8a44%40gmail.com
> 
> .
>


-- 
*Noel Nqabeni Simela*
Web: https://nqabeni.wordpress.com

*"The Best thing in Life, is Life!"*

-- 
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/CAGBhr7bRv0FC4Bw7F8dpbC%2BqG%2BiA9jCsO-bDr03CagUX7bO0%3Dw%40mail.gmail.com.


Re: Django 4.0 released

2021-12-07 Thread kayhan
Okay, thank you. I really like open source technologies

On Tue, Dec 7, 2021 at 8:00 PM Noel Simela  wrote:

> Great stuff,
>
> On Tue, Dec 7, 2021 at 11:28 AM Mariusz Felisiak <
> felisiak.mari...@gmail.com> wrote:
>
>> Details are available on the Django project weblog:
>>
>> https://www.djangoproject.com/weblog/2021/dec/07/django-40-released/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/3c807ebe-ca79-c317-51e5-0859abbf8a44%40gmail.com
>> 
>> .
>>
>
>
> --
> *Noel Nqabeni Simela*
> Web: https://nqabeni.wordpress.com
>
> *"The Best thing in Life, is Life!"*
>
> --
> 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/CAGBhr7bRv0FC4Bw7F8dpbC%2BqG%2BiA9jCsO-bDr03CagUX7bO0%3Dw%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/CAO-vjEQ4gj63Oj3gdg1T0DdaNW9edJxBy18ZagY4fi3CY7F4UA%40mail.gmail.com.


Re: Django security releases issued: 3.2.10, 3.1.14, and 2.2.25

2021-12-07 Thread kayhan
Okay, thank you. I really like open source technologies

On Tue, Dec 7, 2021 at 11:12 AM Mariusz Felisiak 
wrote:

> Details are available on the Django project weblog:
>
> https://www.djangoproject.com/weblog/2021/dec/07/security-releases/
>
> --
> 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/57fa800c-96e3-894b-2b1e-53d4bd20d653%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/CAO-vjESJJ2yYPQNFeD32xjtMCBNCCYWGHrHM1%3Dx9oBzd3aeOYw%40mail.gmail.com.


Why does sqlmigrate need a connection to an existing database?

2021-12-07 Thread Shmuel Treiger
Wondering why sqlmigrate needs a connection to an existing database.

I understand that for certain commands, it needs the database to generate 
the migration. But for most (basic) commands, no connection is really 
needed.

For example, I created a test project 
and
 
generated migration files. Without ever running the `migrate` command, I 
was able to use `sqlmigrate` perfectly well on all migrations, save the 
last, which drops a `unique_together`.

I'm sure there are other commands which actually need a database connection 
(though I haven't found them yet). Seems to me sqlmigrate could be 
rewritten along the lines of:

   - Try to generate sql from migration file
   - If it hits a command it needs the database, attempt to connect

Or else:

   - If no connection, check if migration file needs connection to database
   
Is there something I'm unaware of?

-- 

This email may contain confidential material; unintended recipients must 
not disseminate, use, or act upon any information in it. If you received 
this email in error, please contact the sender and permanently delete the 
email.

-- 
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/0a3fb366-a95a-46a3-8156-2e2c618f72b4n%40googlegroups.com.