Changes between Version 1 and Version 2 of Ticket #23121, comment 5
- Timestamp:
- Sep 7, 2018, 1:03:07 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #23121, comment 5
v1 v2 1 1 The same bug in version 2.1. Test project in attachment. 2 2 3 Test model: 4 {{{#!python 5 from django.db import models 6 from django.db.models.functions import Cast, Concat, Right 7 8 9 class TestEntity(models.Model): 10 some_property = models.TextField() 11 12 class Meta: 13 ordering = ('some_property',) 14 }}} 15 3 16 Migrations log: 4 {{{ 17 {{{#!bash 5 18 $ python manage.py makemigrations app 6 19 Migrations for 'app': … … 10 23 11 24 Then ordering have been changed. 12 {{{ 25 26 {{{#!python 27 class TestEntity(models.Model): 28 some_property = models.TextField() 29 30 class Meta: 31 ordering = ( 32 Cast(models.Func(models.F('some_property'), models.Value('^\d+'), function='SUBSTRING'), models.IntegerField()), 33 Right(Concat(models.Value('00000'), models.F('some_property')), models.Value(5)) 34 ) 35 }}} 36 37 Migrations log: 38 {{{#!bash 13 39 $ python manage.py makemigrations app 14 40 Migrations for 'app':