Re: enum fields in django

2015-02-27 Thread Gavin Wahl
I would definitely use an enum field that used pep 435 enums instead of choices. The implementation as a real enum in postgres and choices on other databases is perfect. I've used a third-party package, https://github.com/hzdg/django-enumfields, to accomplish this in the past. The ability to us

Re: enum fields in django

2015-02-26 Thread Thomas Stephenson
> You can avoid those couple of joins by making your referenced table primary > key what > your enum value would have been and simple not joining it. > In this case you would simply use your referenced table for data integrity > through > foreign constraint enforcement. True, but when defining

Re: enum fields in django

2015-02-26 Thread Josh Smeaton
> > Contributing to contrib.postgres is a possible > option, but it's not really a postgres specific feature -- almost all > of the major database vendors support it (sqlite being as always the > obvious exception). > This option worries me. I definitely do not like the idea of building a fe

Re: enum fields in django

2015-02-26 Thread Marc Tamlyn
> On that note, I'm kind of worried about your assertion that types in contrib libraries aren't required to support automatic migration. Since migrations were added, we've added support for migrations in most of our custom field types. To clarify, custom fields provided in contrib.postgres are aut

Re: enum fields in django

2015-02-26 Thread charettes
> I try to keep myself out of philosophical arguments. Reference tables > have a purpose (when you're dealing with a set of values that aren't > fully known when you're defining the dataset (eg. custom application > error code tables)), but when the dataset _is_ known in advance an > enum wil

Re: enum fields in django

2015-02-26 Thread Thomas Stephenson
Some general responses to your points: Database support Yep, not all databases support enums and not all support them the same way. That's par for the course when you're trying to abstract across multiple implementations of the same pseudo-standard. Vendor lock-in Enums are hardly vendor lock-in,

Re: enum fields in django

2015-02-26 Thread Marc Tamlyn
I kinda like the idea of enum fields, but I feel they are likely better in theory than in practice. In theory I said I would introduce one as part of contrib.postgres, but I've been putting it off as I'm unconvinced whether it is necessarily ideal anyway when compared to choices or reference tables

enum fields in django

2015-02-25 Thread Thomas Stephenson
As discussed in Issue 24342 , I've got an implementation of EnumField that we've found useful when developing our django REST API that I'd like to add to django core. It was suggested I bring this issue up in the developers mailing list for discussio