#10664: non-serializing fixtures
-----------------------------+----------------------------------------------
Reporter: lsaffre | Owner: nobody
Status: new | Milestone:
Component: django-admin.py | Version: 1.0
Keywords: fixtures | Stage: Unreviewed
Has_patch: 0 |
-----------------------------+----------------------------------------------
I think that a new "non-(de)serializing" type of fixtures might be useful.
If loaddata finds a fixture of this type, then it simply executes it,
assuming it is valid Python code.
Example of how such a fixture might look:
{{{
from myapp import MyModel
def add_mymodel(field1,field2,field3):
MyModel(field1,field2,field3)
add_mymodel("a",1,True)
add_mymodel("b",2,True)
add_mymodel("c",3,True)
}}}
This example is only one possible application; in fact the programmer is
free to write more sophisticated scripts, for example fetch data from
different external sources (including csv files), or fill the database
with randomly generated data,..
Such fixtures would offer the special characteristic that they execute
custom save methods.
They would of course be slower than normal fixtures.
We can also extend dumpdata to support this format, outputting python code
as in the example above.
This would be useful when converting a database after model changes.
--
Ticket URL: <http://code.djangoproject.com/ticket/10664>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---