#29841: Fixtures counting backward
-------------------------------------+-------------------------------------
               Reporter:  Victor     |          Owner:  nobody
  Porton                             |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  2.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I have this problem: [https://stackoverflow.com/q/52709119/856090]

 I want a table to hold both models from fixtures and models generated
 dynamically by my Python code.

 If I add a new fixture record and then run `loaddata` it may overwrite one
 of the dynamically created objects!

 I also need to have fixed (not autogenerated) primary keys in order to
 refer to object from the fixture from my Python code.

 My suggestion:

 Assign to the fixture objects primary keys like `2**31 - 1`, `2**31 - 2`,
 `2**31 - 3` etc. Then the "dynamically created" objects won't be
 overwritten by `loaddata`.

 However I do not know how autoincrement value will behave in this
 situation.

 Please add features to make it possible.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29841>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.bac47667dacf1ffcc6fc43f3a3ea1def%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to