File: syncdata.rst

package info (click to toggle)
python-django-extensions 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,820 kB
  • sloc: python: 18,601; javascript: 7,354; makefile: 108; xml: 17
file content (31 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
syncdata
========

:synopsis: Makes the current database have the same data as the fixture(s), no more, no less.


Introduction
-------------

Django command similar to 'loaddata' but also deletes.
After 'syncdata' has run, the database will have the same data as the fixture - anything
missing will be added, anything different will be updated,
and anything extra will be deleted.

Usage
-----

.. tip::
   Command will loop over *fixtures* inside installed apps and pathes defined in ``FIXTURE_DIRS``.

Assuming that you've got sample.json under *fixtures* directory in one of your ``INSTALLED_APPS``::

  $ python manage.py syncdata sample.json

If you want to keep old records use ``--skip-remove`` option::

   $ python manage syncdata sample.xml --skip-remove

You can provide full path to your fixtures file like::

   $ python manage syncdata /var/fixtures/sample.json