Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-10-15 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"74c5ddc657ef23463793fc466282153d559e67a4" 74c5ddc6]:
 {{{
 #!CommitTicketReference repository=""
 revision="74c5ddc657ef23463793fc466282153d559e67a4"
 [3.0.x] Refs #27910 -- Added __init__.py file for model_enums tests.

 Backport of 1877ec18753947795b7821f8b9176bd7ea7c03a3 from master
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.071c76dc869df763bf765734b876e683%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-10-15 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by GitHub ):

 In [changeset:"1877ec18753947795b7821f8b9176bd7ea7c03a3" 1877ec1]:
 {{{
 #!CommitTicketReference repository=""
 revision="1877ec18753947795b7821f8b9176bd7ea7c03a3"
 Refs #27910 -- Added __init__.py file for model_enums tests.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.74d356bc79bde1b7d1f04beb135f99e7%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-09-24 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"fcaaff9862a93efe8ccd2a23b7e38d62dcf7a9d2" fcaaff9]:
 {{{
 #!CommitTicketReference repository=""
 revision="fcaaff9862a93efe8ccd2a23b7e38d62dcf7a9d2"
 [3.0.x] Refs #27910 -- Doc'd support for enumeration types serialization
 in migrations.

 Backport of aad46ee274b0e294ac055cc199e6595de4ef4164 from master
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.70906951a28dd645429b8d12691fffec%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-09-24 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"aad46ee274b0e294ac055cc199e6595de4ef4164" aad46ee2]:
 {{{
 #!CommitTicketReference repository=""
 revision="aad46ee274b0e294ac055cc199e6595de4ef4164"
 Refs #27910 -- Doc'd support for enumeration types serialization in
 migrations.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.1d1277fec69a752984884f6f5872a8b3%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-09-13 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"4d72c14bafefddd073b715c59834494ab77e9aa1" 4d72c14b]:
 {{{
 #!CommitTicketReference repository=""
 revision="4d72c14bafefddd073b715c59834494ab77e9aa1"
 [3.0.x] Refs #27910 -- Improved documentation for model field choice
 enumeration types.

 Backport of 1c66767d4e472fea27798812817b8a47c6ae22b3 from master
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.3f60fe17817f9f93966fb699cb673087%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-09-13 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"1c66767d4e472fea27798812817b8a47c6ae22b3" 1c66767d]:
 {{{
 #!CommitTicketReference repository=""
 revision="1c66767d4e472fea27798812817b8a47c6ae22b3"
 Refs #27910 -- Improved documentation for model field choice enumeration
 types.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.50a482a3532e7d983ea9e8098d24319a%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-09-04 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"72ebe85a269aab4bdb3829de4846b41f90973c5d" 72ebe85]:
 {{{
 #!CommitTicketReference repository=""
 revision="72ebe85a269aab4bdb3829de4846b41f90973c5d"
 Fixed #27910 -- Added enumeration helpers for use in Field.choices.

 These classes can serve as a base class for user enums, supporting
 translatable human-readable names, or names automatically inferred
 from the enum member name.

 Additional properties make it easy to access the list of names, values
 and display labels.

 Thanks to the following for ideas and reviews:

 Carlton Gibson, Fran Hrženjak, Ian Foote, Mariusz Felisiak, Shai Berger.

 Co-authored-by: Shai Berger 
 Co-authored-by: Nick Pope 
 Co-authored-by: Mariusz Felisiak 
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.89ce004ff33764473a3e1243e613991c%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-07-27 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Nick Pope):

 * needs_docs:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.69efccf3b82b97855e23bbfc754b731c%40djangoproject.com.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-07-04 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Nick Pope
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Nick Pope):

 * owner:  Shai Berger => Nick Pope


Comment:

 New [https://github.com/django/django/pull/11540 PR]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.971fbb108fed97ad8d487d1871c24cb5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-07-04 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Shai
 |  Berger
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

 * needs_docs:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.7b39bbc020f1511b1b40b3386171c35a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-05-20 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Shai
 |  Berger
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 > This ticket really ought to consider the use of database level enums for
 the field. (e.g. ​https://www.postgresql.org/docs/9.1/datatype-enum.html
 ). They provide a lot of efficiency (storage and searching), while
 allowing the DB to contain human readable values (from the point of view
 of anyone querying it), and also having tight data integrity - you get the
 best of everything. MySQL also has support, but it looks a bit different.

 Just wanted to drop a note to mention that PostgreSQL's enum type doesn't
 support value removal (as of 11) and that MySQL stores enum as tinyint
 index of the values so if you perform an ordering change you pretty much
 corrupt your column. The index based value on MySQL poses notable problems
 when joining similar values across tables
 [https://dev.mysql.com/doc/refman/5.7/en/enum.html or ordering by such a
 column]. I believe these two reasons make uses database level enums in a
 database agnostic way really challenging.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.96b982e8be6eb517a58551b90aa58abc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-05-20 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Shai
 |  Berger
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Luke Plant):

 This ticket really ought to consider the use of database level enums for
 the field. (e.g. https://www.postgresql.org/docs/9.1/datatype-enum.html ).
 They provide a lot of efficiency (storage and searching), while allowing
 the DB to contain human readable values (from the point of view of anyone
 querying it), and also having tight data integrity - you get the best of
 everything. MySQL also has support, but it looks a bit different.

 [https://github.com/ashleywaite/django-more/tree/master/django_enum
 django_enum] implements this, but it requires a significant number of
 patches to Django machinery, which django_enum does by monkey patching. In
 particular, you need to track changes to the enum in order to generate
 'CREATE TYPE' and 'ALTER TYPE' (for Postgres at least). It would be great
 to have a solution in Django core so that we could avoid that kind of
 monkey patching.

 We might want to consider this as a separate ticket, but it would be a
 shame to solve the problem half-way. At the very least we should ensure
 that the solution we adopt would be future compatible with using DB-level
 enums.

 There may well be some good ideas from
 [https://techspot.zzzeek.org/2011/01/14/the-enum-recipe/ Mike Bayer's post
 about enums] that we can make use of. His `DeclEnum` base class is very
 similar in interface to `EnumChoices`, which is a good sign at least!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.930d5cf9df2ccf854bceecfa41e786fc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-04-15 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Shai
 |  Berger
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.65b4168a91777df1c57e27b608b8a33c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-04-14 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Shai
 |  Berger
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * stage:  Unreviewed => Accepted


Comment:

 Given the extended discussion on django-developers to re-open this ticket
 I'll move it to "accepted": (group) review will decide finally if we're
 going to merge. (But if I read the thread right, the consensus seemed to
 be in favour...)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.6c57002ae48e2272d75dd1b7aa12ca3c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-04-13 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  Shai
 |  Berger
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Shai Berger):

 * owner:  nobody => Shai Berger
 * status:  new => assigned
 * version:  1.10 => master


Comment:

 [https://github.com/django/django/pull/11223 PR]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.6deb451c145bc039a7d75b229b73850d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-04-13 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Shai Berger):

 * status:  closed => new
 * resolution:  wontfix =>


Comment:

 Reopening, following the [https://groups.google.com/forum/#!msg/django-
 developers/bCJ28uz0QFE/UZVIMWtWDgAJ discussion on the developers list] and
 oral discussions with technical-team members on the DC-EU sprints.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.2312dcdbddece2d113401039bf0c5d89%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2019-01-11 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Ryan Hiebert):

 * cc: Ryan Hiebert (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.5867fd11505398d11577eee85cdb2d16%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2017-08-03 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Marcel Hellwig):

 I like the solution Tim brought up. Maybe making the second item on the
 enum optional, so that you could still write
 {{{
 Freshman = 'FR',
 }}}

 and for default just use an untranslated name of the field (e.g.
 Freshman).

 How do you like it?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.931fc33b283b01e25ec07268035be539%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2017-08-03 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tom):

 * cc: Tom (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.f292cec604a573728365c5b5683372bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices

2017-08-03 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tom):

 I know this is a closed ticket, but a pattern I've has success with is a
 custom `enum` subclass that combines the values with the display:

 {{{#!python
 class StudentType(EnumChoices):
 Freshman = 'FR', _('Freshman')
 Sophomore = 'SO', _('Sophomore')
 Junior = 'JR', _('Junior')
 Senior = 'SR', _('Senior')
 }}}

 It's somewhat simple to do, the EnumChoices class splits the initial enum
 values into value, display, and exposes the display text as an attribute:
 `StudentType.Freshman.display` (and in the __str__ method).
 list(StudentType) returns a list of tuples that is suitable for `choices`.

 Could this not be an OK compromise? In the applications I've seen with
 large numbers of choices managing the display values gets to be a burden,
 the values should indeed be separate from the display and not auto-
 generated but there is a tangible benefit in keeping their definitions as
 close as possible together. Splitting the definition of an enum out into
 two parts in the django-way seems to violate DRY, no?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.b20dfdb30398f1e24367d8b009e6061e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27910: Allow using an Enum class in model Field choices (was: Use Enum class in model choices)

2017-03-08 Thread Django
#27910: Allow using an Enum class in model Field choices
-+-
 Reporter:  Marcel Hellwig   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  enum model choices   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 I agree with Simon's analysis. An automatic translation based on the enum
 value doesn't seem like a proper separate of concerns.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.9a6a51e4c6c315f1443251e52ea63184%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.