Changes between Initial Version and Version 1 of Ticket #28822
- Timestamp:
- Nov 20, 2017, 9:29:13 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28822 – Description
initial v1 9 9 10 10 {{{ 11 11 12 class Customer(models.Model): 12 13 first_name = models.CharField(max_length=255) … … 56 57 What we suggest: 57 58 58 cl 59 59 60 {{{ 60 ass Customer(models.Model): 61 62 class Customer(models.Model): 61 63 first_name = models.CharField(max_length=255) 62 64 last_name = models.CharField(max_length=255) 63 65 age = models.IntegerField() 64 allowed_to_drink = models.DBCalculatedField(Q(age__gt=18) models.BooleanField())66 allowed_to_drink = models.DBCalculatedField(Q(age__gt=18), models.BooleanField()) 65 67 }}} 66 68 … … 69 71 70 72 I believe this syntax is much more clear and we have consensus about in on group: 71 [https://groups.google.com/forum/#!topic/django-developers/ADSuUUuZp3Q 72 ] 73 [https://groups.google.com/forum/#!topic/django-developers/ADSuUUuZp3Q] 73 74 We may also have 74 75 … … 81 82 82 83 {{{ 83 allowed_to_drink = models.DBCalculatedField(Q(age__gt=18) models.BooleanField(), local=lambda c: c.age > 18)84 allowed_to_drink = models.DBCalculatedField(Q(age__gt=18), models.BooleanField(), local=lambda c: c.age > 18) 84 85 85 86 # or