Re: Passing an ID through a Modal to delete a user in a View

2018-11-06 Thread Daniel Roseman
On Monday, 5 November 2018 11:17:49 UTC, Mauro Caresimo wrote: > > Hello Im having some issues trying to pass an id through a modal. > Basically I want to pass an id through a modal, via urls.py and to hit a > function in the views to delete the user. > This is my modal: > > Much appreciated for

Channels: event loop and thread

2018-11-06 Thread Zhiyu (Drew) Li
Hi there, I got the following 2 questions There is only one thread (MainThread) and one event loop running on it by default if all existing consumers are asynchronous consumers? Regular sync views (if any) are handled by Threadpoolexecutor and run in a sub Thread. These sync views won't block th

Re: Adding Channels to and Existing Django Application

2018-11-06 Thread jz
> > even down to running two different servers for that project, one normal > WSGI one and one ASGI one to let you do async things. I've tried doing that, but failed. I've created a asgi.py file and tried to run it with daphne, but the server didn't start. Daphne simply hang there. To my surp

Re: Setting up admin in visual studio

2018-11-06 Thread Jason
visual studio, the .net/C# IDE, is not for python (at least none of the versions I've used) So not sure how to help you other than suggest another IDE -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rece

Template filter {{ value|date:"M" }} in Python

2018-11-06 Thread Carsten Fuchs
Hello, complementing template filters, sometimes it is necessary to format dates also in Python code, that is, achieve the equivalent to {{ value|date:"M" }} For this, I'm using from django.utils import dateformat dateformat.format(value, "M") (This works in Django views and in

Re: Channels: event loop and thread

2018-11-06 Thread Andrew Godwin
Your assumptions are correct. The only extra thing to be aware of is that some Django interactions (like the Channels Auth middleware) need to do database connections and thus have to launch into a subthread for that, but that's also managed. Andrew On Tue, Nov 6, 2018 at 4:41 AM Zhiyu (Drew) Li

Re: Adding Channels to and Existing Django Application

2018-11-06 Thread Andrew Godwin
I'm afraid I don't have an easy example to hand - maybe someone else does. It sounds like you might have something odd in your settings, models.py, or other files that load at startup. Andrew On Tue, Nov 6, 2018 at 5:31 AM wrote: > even down to running two different servers for that project, on

My developers have run amok

2018-11-06 Thread Dan Davis
My developers, who have come from ColdFusion, are fond of this: cursor = connection.cursor() cursor.execute() data = [r for r in cursor] return render(request, some_template_name, {'data': data}) The problem with this is that the database cursor reference will be leaked. How do I integrate into

Re: My developers have run amok

2018-11-06 Thread Jason
refactor to use the ORM for those bits? and implement a team styleguide that says no direct connections unless its proven to work better? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: My developers have run amok

2018-11-06 Thread Dan Davis
On Tuesday, November 6, 2018 at 2:32:52 PM UTC-5, Jason wrote: > > refactor to use the ORM for those bits? and implement a team styleguide > that says no direct connections unless its proven to work better? > I'm looking to identify the memory consuming bits to allow refactor. Not a bad ide

Re: Setting up admin in visual studio

2018-11-06 Thread Saeed Pooladzadeh
There are some tools for visual studio which can make it a python IDE. .I want just want to make the admin.py to work. What are other IDE's for Django? در سه‌شنبه 6 نوامبر 2018، ساعت 6:03:32 (UTC-8)، Jason نوشته: > > visual studio, the .net/C# IDE, is not for python (at least none of the > versio

RE: Setting up admin in visual studio

2018-11-06 Thread Matthew Pava
PyCharm From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Saeed Pooladzadeh Sent: Tuesday, November 6, 2018 3:31 PM To: Django users Subject: Re: Setting up admin in visual studio There are some tools for visual studio which can make it a python IDE. .I want

Re: My developers have run amok

2018-11-06 Thread Jason
oh boy... Good luck. you can use connection.cursor() as a context manager, which will clean up connections after it exits. You could grep the project for connection.cursor and add the context manager. how did none of the devs know to clean up after themselves, either with a context manager

Re: My developers have run amok

2018-11-06 Thread Dan Davis
I am less certain this is the problem now. It may simply be that my project is one of the larger on the server. I did a quick audit, and although they are new to django, they either used connection.cursor() as a context manager, or called close explicitly. I will try to develop a middleware ar

Re: My developers have run amok

2018-11-06 Thread Dan Davis
This will likely do it - tracking as a django middleware, I suspect too much will still be lazy: https://pypi.org/project/wsgi-objgraph/ On Tue, Nov 6, 2018 at 6:39 PM Dan Davis wrote: > I am less certain this is the problem now. It may simply be that my > project is one of the larger on the

Re: Django Channels - core.py error

2018-11-06 Thread Paul Whipp
I've just had trouble with exactly the same error. In my case I was building from the tutorial ChatConsumer with my own XChatConsumer and I hadn't referenced it in the routing.py. As a result the tutorial async chat consumer was receiving a scope that did not contain a room_name in its url_rout

Re: Setting up admin in visual studio

2018-11-06 Thread Phako Perez
I can recommend py charm Sent from my iPhone > On Nov 6, 2018, at 3:32 PM, Matthew Pava wrote: > > PyCharm > > From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On > Behalf Of Saeed Pooladzadeh > Sent: Tuesday, November 6, 2018 3:31 PM > To: Django users > Subject:

Re: Setting up admin in visual studio

2018-11-06 Thread Saeed Pooladzadeh
But my problem is there is no admin page!! What is wrong? please inform me. در سه‌شنبه 6 نوامبر 2018، ساعت 17:39:25 (UTC-8)، Phako Perez نوشته: > > I can recommend py charm > > Sent from my iPhone > > On Nov 6, 2018, at 3:32 PM, Matthew Pava > > wrote: > > PyCharm > > > > *From:* django...@goo