Changes between Initial Version and Version 1 of Ticket #35694
- Timestamp:
- Aug 20, 2024, 7:11:42 AM (3 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35694 – Description
initial v1 1 1 While any orm `filter`, `get`, ... accepts a `pk` or instance `get_or_create` does not. For consistency `get_or_create` should also be able to handle instances and pk's interchangeably. 2 2 3 3 4 models.py: 4 ``` 5 {{{ 5 6 from django.db import models 6 7 … … 14 15 bar = models.CharField(max_length=100) 15 16 16 ``` 17 }}} 17 18 18 19 tests.py 19 ``` 20 {{{ 20 21 from testing.utils import TestCase 21 22 from zfoo import models … … 35 36 models.B.objects.get_or_create(dict(bar="does not exist"), bar="baz", a=a) 36 37 models.B.objects.get_or_create(dict(bar="does not exist"), bar="baz", a=a.pk) # FAILS 37 ``` 38 }}}