#30095: Choices do not accept tuples is actual value
-----------------------------------------+-------------------------------
               Reporter:  msart          |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Uncategorized  |        Version:  2.1
               Severity:  Normal         |       Keywords:  choices tuple
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+-------------------------------
 Since version 2.1 django stopped to accept tuples as value in choices.

 I'll give you an example using the User model so you can reproduce. The
 error occurs when I do manage.py runserver.

 I tried to find in the release notes from django 2.1.* versions but
 couldn't find something adressing this change. This model works with
 django version 2.0.10 and below.

   {{{#!python
 from __future__ import unicode_literals
 from django.db import models
 from django.contrib.postgres.fields import IntegerRangeField


 class Article(models.Model):

     LTE_50 = (1, 50)
     LTE_100 = (51, 100)

     SIZE_CHOICES = (
         (LTE_50, "1-50"),
         (LTE_100, "51-100"),
     )

     article_size = IntegerRangeField(choices=SIZE_CHOICES)
    """
    django.core.management.base.SystemCheckError: SystemCheckError: System
 check identified some issues:

    ERRORS:
    article.Article.article_size: (fields.E005) 'choices' must be an
 iterable containing (actual value, human readable name) tuples.
    """

     published = models.BooleanField("Is published", default=False)

     class Meta:
         verbose_name = "Article"
         verbose_name_plural = "Articles"

     def __str__(self):
         return "test"

   }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30095>
Django <https://code.djangoproject.com/>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.69716bb8c70ad1c8fcf3f909b934dce3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to