Changes between Initial Version and Version 2 of Ticket #9269
- Timestamp:
- Oct 2, 2008, 8:08:31 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #9269
- Property Cc added
-
Ticket #9269 – Description
initial v2 1 when i used get_or_create """p, created = Inventory.objects.get_or_create(product = pr, location = lo, storage_type = storagetype) 2 if created: 3 p.amount = amount1 4 p.save() 5 else: 6 form.save()""" 1 when i used get_or_create 2 3 {{{ 4 p, created = Inventory.objects.get_or_create(product = pr, location = lo, storage_type = storagetype) 5 if created: 6 p.amount = amount1 7 p.save() 8 else: 9 form.save() 10 }}} 11 7 12 it would fail on created, and then it would save the form and make 2 records in the database the second time it would give me a error that it found 2 of the same record 8 13 9 14 the model and form file: http://dpaste.com/81855/ 15 10 16 the product model file: http://dpaste.com/81866/ 17 11 18 the view code: http://dpaste.com/81855/ 12 19