Hi,
I have a custom method on my model manager that allows me to listen for
notifications from modifications on the DB using postgreSQL. A short
version of this code looks like this:
def listen_for_notify(self):
import select
import psycopg2
import psycopg2.extensions
Personally, the snippet suggested in the ticket is sufficient for my needs
(although I'm saddened by having to duplicate the setattr logic).
However, I filed the ticket after Googling "Django conditional
update_or_create" and finding no appropriate solution. You might be right
about the use case
Hi all,
Lately I've run into ticket 27910[1], which asks for Python Enums to be
usable for generating choices in Django model (and form) fields. This
ticket was closed Wontfix because the original suggestion did not offer
any way to handle translated labels. However, after the ticket was
closed, T
FWIW I'm pretty strongly -1 on this feature because Python's enums don't
behave the way people want them to for many use cases.
The basic problem is that, to take the example in the ticket, if I were to
issue a request like "/students/?year=FR", and the view were to read that
"year" param and try
Hey Shai,
I have not had a chance to look at the implementation, but I was describing
my django-choice-object library[1] and forgot to link it!
I would be +1 on re-opening it, I've used enums for this before and I find
it much more DRY than the more 'standard' Django way. Perhaps we could
reduce s
Hi James,
On Mon, 31 Dec 2018 10:24:39 -0800
James Bennett wrote:
> The basic problem is that, to take the example in the ticket, if I
> were to issue a request like "/students/?year=FR", and the view were
> to read that "year" param and try to filter on it, it would fail --
> the string "FR" wi
Hi Tom,
On Mon, 31 Dec 2018 18:26:14 +
Tom Forbes wrote:
> I was describing my django-choice-object library[1] and forgot to
> link it!
>
Thanks, I took a look -- the library looks nice, but notably, Choice
objects are not Python enums, although they share some of their traits.
> I would
Unfortunately I made this for a python 2 app before enums where in the
standard library. I think it has some useful ideas though especially around
categories, which I find I needed a lot. I'd be interested to know if
anyone else has written any workflow-driven apps in Django that require
groups of
I would also love to see a decent way to use enums as choices. The
translation issues seem the stickiest to me, but I'm kinda hoping we can
come up with something reasonable.
I'm a heavy user, but mostly a lurker on this list, but +1 from me for what
it's worth.
Ryan
On Mon, Dec 31, 2018, 17:41