0

as the title says. Is there a possible way to create fixtures in the view with Django?

Thanks a lot!

  • 2
    I don't understand your question. Can you provide an example? – Don Jul 29 '14 at 14:02
  • You can dump the database with ./manage.py dumpdata app_name > dump.json But i want to create a function in the Admin Panel which allows me to download this fixture – user3357845 Jul 29 '14 at 14:41

1 Answers1

1

You can call dumpdata in your view with call_command (docs here: https://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code).

See this answer: How to use call_command with dumpdata command to save json to file

Community
  • 1
  • 1
Don
  • 16,928
  • 12
  • 63
  • 101