Changes between Initial Version and Version 2 of Ticket #9269


Ignore:
Timestamp:
Oct 2, 2008, 8:08:31 AM (16 years ago)
Author:
Karen Tracey
Comment:

Reformatted description.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9269

    • Property Cc kenkam@… 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()"""
     1when 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
    712it 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
    813
    914the model and form file: http://dpaste.com/81855/
     15
    1016the product model file:  http://dpaste.com/81866/
     17
    1118the view code:     http://dpaste.com/81855/
    1219
Back to Top