1

I try to test extended version of Django flatpages and need to create fixture for it. It's incredibly straightforward to create one for a custom model. For example, to create a fixture for a auth.User model, I should execute the following command in terminal:

$ python manage.py dumpdata auth.User > /path/to/fixture.json

How can I do the same thing for the django.flatpages module? (see the explanation below)


I extended the django.contrib.flatpages.models.FlatPage model as follows:

from django.db import models
from django.contrib.flatpages.models import FlatPage

class FooProject(models.Model):
    pass

class FooFlatPage(FlatPage):
    project = models.ForeignKey(FooProject)

The code above will create 4 tables in a database when I execute the migrate command (1 for FooProject, 1 for FooFlatPage and 2 for Django Flatpages).

Now when I try to execute dumpdata for my module:

$ python manage.py dumpdata my_module > /path/to/fixture.json

...I'll get dump of only 2 tables (except flatpages tables). The fixture.json file:

[
  {
    "model": "my_module.fooproject",
    "pk": 1
  },
  {
    "model": "my_module.fooflatpage",
    "pk": 1,
    "fields": {
      "project": 1
    }
  }
]

Question: How I can create a data dump for all (4) tables?


When I try to add --verbosity=3 argument the same output.

Yurii Rabeshko
  • 591
  • 8
  • 17

0 Answers0