Initial data no longer works
bufke opened this issue · comments
Since the south clean up. No idea why. This is what we were doing before.
Add initial data just once!
from django.db import connections, DEFAULT_DB_ALIAS
connection = connections[DEFAULT_DB_ALIAS]
if 'mysql' in connection.settings_dict['ENGINE']:
cursor = connection.cursor()
cursor.execute('SET foreign_key_checks = 0')
from django.core.management import call_command
call_command("loaddata", "initial.json")
if 'mysql' in connection.settings_dict['ENGINE']:
cursor = connection.cursor()
cursor.execute('SET foreign_key_checks = 1')
connection.close()
I'm not really liking any solution here. The safest way would be manually creating the objects with Django ORM. We also need fake objects for testing. Do you think you could work on this? It's fairly labor intensive but might be a good starter programming project. Basically it would be a ton of
Something.objects.create(name="bob", foo="whatever")
You'd have to have one group of global defaults (group permissions for example) then many groups for sample data. We could use the sample data for demo too. It would be great to have more data in demo anyway.