Changes between Initial Version and Version 1 of Ticket #26131


Ignore:
Timestamp:
Jan 24, 2016, 9:28:35 AM (9 years ago)
Author:
stiffupperlip
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26131 – Description

    initial v1  
    11In Django 1.8.8 when I create a model class like below, choices are not enforced when creating an instance of the model class:
    22
    3 class HTTPMethod(models.Model):
    4     HTTP_METHODS = [(_, _) for _ in ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace', 'connect']]
     3    class HTTPMethod(models.Model):
     4        HTTP_METHODS = [(_, _) for _ in ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace', 'connect']]
    55
    6     id = models.AutoField(primary_key=True)
    7     name = models.CharField(choices=HTTP_METHODS, unique=True, max_length=255)
     6        id = models.AutoField(primary_key=True)
     7        name = models.CharField(choices=HTTP_METHODS, unique=True, max_length=255)
    88
    99
    10 h = HTTPMethod(name='something invalid')
    11 h.save()
     10    h = HTTPMethod(name='something invalid')
     11    h.save()
    1212
    1313No errors are raised.
Back to Top