A fixture is a collection of data that Django knows how to import into a database, can be written as XML, YAML, or JSON documents. They can be used to provide initial data for models.
Questions tagged [django-fixtures]
187 questions
0
votes
2 answers
Does Django adequately support node anchors (&) and references (*) in YAML fixtures?
Does Django support node &anchors and *references in YAML fixtures?
Example of how a YAML fixture with an anchor and a reference would look like:
- model: auth.group
pk: &somegroup 1
fields:
name: "some group"
- model: auth.user
pk: 1
…

Anton Strogonoff
- 32,294
- 8
- 53
- 61
0
votes
2 answers
loaddata raises IntegrityError when called within migration, but works if called from the CLI
For my Django 1.8.12 site I have an example_content fixture which fills in some initial site content.
If I load this this right after running migrate it imports fine:
$ ./manage.py migrate --noinput
Operations to perform:
Synchronize unmigrated…

Robin Winslow
- 10,908
- 8
- 62
- 91
0
votes
1 answer
Badly Formed hexadecimal uuid string error in Django fixture; json uuid conversion fails issue
File "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 2390, in get_db_prep_value
value = uuid.UUID(value)
File "/usr/lib/python2.7/uuid.py", line 134, in __init__
raise ValueError('badly…

Malik A. Rumi
- 1,855
- 4
- 25
- 36
0
votes
1 answer
Django 1.8 Fixture Integrity Error - Model field is violated by not-null constraint
I have implemented some models and migrations into my postgreSQL9.4 database works. I have some models. For an example the SkillLevelRuleModel:
class SkillLevelRule(models.Model):
skillLevelRuleID = models.AutoField(primary_key=True)
skillCategoryID…

Dante
- 45
- 1
- 6
0
votes
1 answer
Django: Saving oauth provider data
I set up a simple django site using django-allauth.
I created some oauth providers in the database.
Everything is fine and working on my laptop now.
I would like to store the created database tables somehow.
Use case: I want to set up a new…

guettli
- 25,042
- 81
- 346
- 663
0
votes
2 answers
Run migrations without loading initial_data.json
I provide a lista of users for my application in a json located in my app:
myapp/
fixtures/
initial_data.json
it load everytime I run python manage.py migrate. I've read the Providing initial data for models document, but it does not mention…

Gocht
- 9,924
- 3
- 42
- 81
0
votes
1 answer
Calling loaddata in Django 1.7 migrations is throwing "Unknown column '[field]' in 'field list'"
I'm running into an issue in Django 1.7 when attempting to write multiple migrations in a row. Here's the basic setup of the migrations:
Initial schema migration to create the models for an app
Data migration that calls loaddata on a specific…

Scott
- 61
- 6
0
votes
1 answer
How to show what fixtures are installed when I run migrate command in Django?
I am using Django 1.6 and South for migrations. I have one single fixture initial_data.json. When i run ./manage.py syncdb I get
Installed 48 object(s) from 1 fixture(s)
However when I run ./manage.py migrate I get
Installed 96 object(s) from 2…

Sashko Lykhenko
- 1,554
- 4
- 20
- 36
0
votes
0 answers
google app engine datastore django-nonrel Invalid model identifier on loading fixture
I'm trying to implement django-nonrel on google app engine using datastore as database but i'm getting error on loading fixtures on local development server
DeserializationError: Problem installing fixture…

jvaldenor
- 67
- 1
- 6
0
votes
1 answer
Relative fixture paths in Django not working on Windows
I have a Django 1.6.6 project that is not loading fixtures from relative paths using Python 2.7.8 on Windows 8.1. Works just fine in Linux.
Example Test Case:
# cart/tests.py
class CartTestBase(TestCase):
fixtures =…

Brandon Taylor
- 33,823
- 15
- 104
- 144
0
votes
1 answer
Is there a way to prevent fixtures from loading according the environment?
I use en .env file per environement to set settings variables that must be different according the environment. An exemple would be:
in settings.py file:
DEBUG = (os.environ['DJANGO_DEBUG'] in ['True', 'true'])
in .env file of DEV…

David Dahan
- 10,576
- 11
- 64
- 137
0
votes
1 answer
Django 1.6.1 Fixtures not getting loaded for Unittest
Django is not loading fixtures for the following test.
from django.test import TestCase
class DevViewsTests(TestCase):
fixtures = ['device/fixtures/test_device.json']
def setUp(self):
self.client = Client()
self.username =…

Pawan
- 4,249
- 6
- 27
- 32
0
votes
1 answer
Django Providing initial data for models with model triggers
I have a Django 1.6.2 application, some of model logics (overrided "save" methods and signal event handlers), and I use the loaddata fixture\data.json command to populate the initial database.
But, problem is - loaddata doesn't triggering the save…

Y.N
- 4,989
- 7
- 34
- 61
0
votes
1 answer
Options for Loading Fixtures in a Django Database
On https://docs.djangoproject.com/en/dev/howto/initial-data/, it says to run manage.py loaddata to re-load data, or to name a fixture "initial_data" to load it with every migrate.
On the page…

Michelle Glauser
- 1,097
- 16
- 28
0
votes
1 answer
Whenever a new user is created, I want to create a "starter kit" of records for that user that is the same for all users
I've read the docs for Django that indicate using Fixtures or SQL when the APP is created. But I want to add the same fixture every time a new user is added. I'm not seeing an easy way to do this. I think that signals.py might be a way to do it, but…

Dave Merwin
- 1,382
- 2
- 22
- 44