Need to get user_id outside of a view

2017-01-29 Thread Victor Porton
See also https://code.djangoproject.com/ticket/27786 I attempt to make file storage behavior dependent on the current user. (In fact, I attempted to store the ID of the uploader of a given file into the database, so that other users could not list or delete this file. Also I tried to store the

Re: Need to get user_id outside of a view

2017-01-29 Thread Victor Porton
:10 PM UTC+2, Victor Porton wrote: > > See also > https://code.djangoproject.com/ticket/27786 > > I attempt to make file storage behavior dependent on the current user. > (In fact, I attempted to store the ID of the uploader of a given file > into the database, so that other

Re: Composite fields

2016-10-16 Thread Victor Porton
I have implemented something like this: https://bitbucket.org/portonv/composite-fields (I did my implementation before reading my thread.) Please feel free to use and modify my code. Well, now I should read this thread and

Need to set socket options, for no breaking after a timeout

2017-05-12 Thread Victor Porton
About https://github.com/django/channels In the past I dealt with another Python WebSocket engine (unrelated to Django). The connection was breaking after a timeout. I solved this problem adding: sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) sock.setsockopt(socket.SOL_TCP,

My proposal to create a new exception

2020-02-08 Thread Victor Porton
In https://code.djangoproject.com/ticket/31239 I proposed to create QueryDictKeyError derived from MultiValueDictKeyError and raise this exception on a missing parameter in request.GET and request.POST. It is to be done to handle error in user data easily: try: x = request.GET['x'] except

Re: My proposal to create a new exception

2020-02-09 Thread Victor Porton
t;] ifnotall(k inrequest.GET.keys()fork inrequired): returnMyErrorResponse(...) | I've used the latter approach if I have required parameters in a GET/POST and I'm not using forms. I  just adding the check to a base view and having required be an attribute On Sunday, 9 February 202