Re: Is there a function that returns common elements in multiple lists

2022-01-26 Thread Nick Farrell
>>> a = {1, 2, 3} >>> b = {2, 3, 4} >>> a & b {2, 3} On Wednesday, 26 January 2022 at 23:52:05 UTC+11 xaadx...@gmail.com wrote: > a = [1,2,3,4] > b = [3,4,5,6] > > Convert list a to set > a_set = set(a) > print(a_set.intersection(b)) > > On Wed, Jan 26, 2022, 5:47 PM Muhammad Shehzad wrote: > >>

Re: Eliminating inter-request race conditions

2022-01-08 Thread Nick Farrell
I thought I'd post a little update, as I'm fairly happy with my progress: Here's the repo's readme. I haven't actually pushed the package to pypi so don't try to follow the instructions yet, but any feedback on the README's content is very welcome: https://github.com/nicois/nango/blob/develop/R

Re: Eliminating inter-request race conditions

2021-12-31 Thread Nick Farrell
Good to hear from you Carsten. Thanks in advance for your comments. I'll see what I can address now: > > > *2)* Not being able to safely lock a model/queryset beyond the lifetime > of the request. > I don't quite understand this. It sounds like pessimistic locking? Correct. To be clear, I am n

"include super" with django templates?

2021-12-30 Thread Nick Farrell
I would like to extend a django template which is used via the include macro. That is, I want to add additional output before or after what would otherwise be emitted. With the normal {% block %} syntax, it's easy to use super to follow the template heirachy similar to __mro__ - but to my knowl

Re: Automatic subdomain for each user

2021-12-30 Thread Nick Farrell
Once you have the TLS certificates and routing working, can't you make a tiny piece of middleware which takes the hostname (provided via nginx/apache in a request header) and add an attribute on the request which corresponds to your virtual site? e.g. (dodgy untested code follows): def multisit

Re: Eliminating inter-request race conditions

2021-12-28 Thread Nick Farrell
le.com/d/msg/django-users/R7wJBTlC8ZM/MIzvYkWyCwAJ > help? > > Best regards, > Carsten > > > Am 27.12.21 um 06:36 schrieb Nick Farrell: > > Hi all. > > > > I've been using Django for quite a number of years now, in various ways. > Most of the time, I find

Eliminating inter-request race conditions

2021-12-27 Thread Nick Farrell
Hi all. I've been using Django for quite a number of years now, in various ways. Most of the time, I find myself needing to create custom solutions to solve what appears to be a very common problem. During the Christmas downtime, I decided to scratch this itch, and am putting together what wi