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
0 answers
Django not loading fixtures when there is post_save signal
I am testing a registration function in my Django app. When users register, a default user_type is designated to the user. I am using a post_save signal to process this.
I have a Profile model to be connected with the User and under the Profile…

Nikko
- 1,410
- 1
- 22
- 49
0
votes
0 answers
400 error while loading fixtures onto AWS S3 for Django
I have a django project with aws s3 used to store images the website has.
The website allows users to upload their own image, and that works just fine. When I add a model instance with a jpg, the file is uploaded to aws and can be viewed in the…

NicholasM
- 13
- 1
- 6
0
votes
0 answers
Django Python - Can`t install fixtures in test database
HiEveryone
Got some problem why trying to load fixtures in Django test database.
I made fixture of DB by exec command
python manage.py dumpdata misxapp --format=yaml --indent=4 > misxapp/fixtures/misxapp.yaml
In misxapp.tests.py I use…

meshi
- 1
- 2
0
votes
1 answer
Django fixture append to existing data
I have a table which contains some data already.
Can a fixture be created with new data records and be appended to the existing data in the table, without specifying a pk explicitly?

akash deep
- 135
- 10
0
votes
1 answer
Django test with fixtures gives ForeignKeyViolation or IntegrityError
I am trying to write test cases for the Django RestAPI that we have but I have an issue with the fixtures loading. Everything works correctly when I have only one TestCase but when I add a second TestCase in a second django app I get…

Thirsty
- 188
- 2
- 12
0
votes
1 answer
Django REST with pytest fixture integrity error
I am trying to create a fixture with pytest, but when I run it, I get the following error:
django.db.utils.IntegrityError: NOT NULL constraint failed: authtoken_token.user_id
I found information on it, but I am not sure how to handle it when it…

Veneta
- 33
- 5
0
votes
0 answers
Self-incrementing primary keys, values that follow or not. Foreign key bindings (django)
I am making a classic bdd and I had a doubt expressed by another dev:
To put it simply, I have 2 tables (with very very few updates), one of which has an FK (foreign key) on the other. There is an autoincrement on the PK (primary key).
With Django I…

fabrice
- 1,399
- 1
- 15
- 27
0
votes
0 answers
Django - best way to manage existing, auto increment fields with existing data?
This is still in dev, so I am relatively flexible in how to approach this.
So I'm importing data (via fixtures, the import works fine) from an existing database into a django application. The source data is not uniformed in how it manages ID &…

logicOnAbstractions
- 2,178
- 4
- 25
- 37
0
votes
1 answer
How to write unittest for django project that using two database (mysql and mongo)
My django projects use two type of database (mariadb and mongoengine) I have no idea how to write the unittest that test both of them in the same testcase. please guide me.
now i try to use fixtures_mongoengine to write fixture mongo data but that…

Fah Nateecha
- 151
- 3
- 14
0
votes
1 answer
DJANGO: How to specify primary key in fixture when the primary key is not "id"
I just changed my pk name in a model.
This is how my model was:
class Course(LogsMixin, models.Model):
"""Definición del modelo de Proveedor."""
name = models.CharField("Nombre del curso", null=False, default="", max_length=200)
code =…

AngelQuesada
- 387
- 4
- 19
0
votes
1 answer
When using natural_keys in Django, how can I distinguish between creates & updates?
In Django, I often copy model fixtures from one database to another. My models use natural_keys (though I'm not sure that's relevant) during serialization. How can I ensure the instances that have been updated in one database are not inserted into…

trubliphone
- 4,132
- 3
- 42
- 66
0
votes
1 answer
Fixtures data for model containing images, files and tags
I am using Djano 3.1, Python 3.6, easy-thumbnails 2.7 and django-taggit 1.3
I want to create a fixtures data file for my model.
Here is my (simplified) model:
myapp/models.py
class Post(models.Model):
featured_image =…

Homunculus Reticulli
- 65,167
- 81
- 216
- 341
0
votes
2 answers
Why my fixture is not installing on django project?
I created a backup of database using fixtures in my django project by following command:-
python manage.py dumpdata > db.json
when i load the fixture, i get following error:-
django.db.utils.IntegrityError: Problem installing fixture…

Gagan Singh
- 200
- 1
- 13
0
votes
0 answers
Loading dynamic initial data in runtime in Django app
The issue:
I have some models structure in my Django app:
Company
Category (category has fk relation to companies)
Payment (it doesn't matter in this context, just for the big picture, every payment has a category and a company)
Users can…

Fedor Ivanov
- 60
- 6
0
votes
0 answers
Django Natural Keys Unable to Load For Some Models
I have a project with several models All of which I am implementing natural keys. Most of these are working but there is one model (so far) that refuses to load when I export using natural keys.
NOTE: If I don't use natural keys when exporting it…

Alex
- 1,891
- 3
- 23
- 39