Skip to content

Commit 96f99c1

Browse files
committed
readme updated
1 parent 36670b2 commit 96f99c1

File tree

3 files changed

+93
-36
lines changed

3 files changed

+93
-36
lines changed

README.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

README.rst

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Django Advance Dumpdata
2+
========================
3+
4+
Django Manage Command like ``dumpdata`` but with have more feature to Output the contents of the database from given fields of a model
5+
and filter that data using standard Django lookups for filtering.
6+
data can be export with divers format like json,xml,yaml.exported structure is compatible with Django ``dumpdata`` structure which
7+
allows you to use standard ``loaddata`` command for import.
8+
xx
9+
10+
Installation
11+
------------
12+
13+
To get the latest stable release from PyPi
14+
15+
16+
pip install django-dumpdata-advance
17+
18+
19+
Add ``dumpdata_advance`` to your ``INSTALLED_APPS``
20+
21+
22+
INSTALLED_APPS = (
23+
...,
24+
"django_dumpdata_advance",
25+
)
26+
27+
Usage
28+
-----
29+
30+
Export data:
31+
32+
33+
34+
./manage.py dumpdata_one app_name.model_name --fields=field1,field2 > dump_file.json
35+
36+
37+
Import data:
38+
39+
40+
41+
./manage.py loaddata dump_file.json
42+
43+
44+
How to use filters? If you not familiar take a look at Django Field
45+
lookups - https://docs.djangoproject.com/en/3.0/topics/db/queries/#field-lookups
46+
47+
48+
49+
./manage.py dumpdata_one app_name.model_name --fields=field1 --filter=name__icontains=django
50+
51+
./manage.py dumpdata_one app_name.model_name --fields=field1 --filter=name__icontains=django,pk__gt=300
52+
53+
Set order by:
54+
55+
56+
57+
./manage.py dumpdata_advance app_name.model_name --fields=field1,field2 --order=field2,field2
58+
59+
Export all fields:
60+
61+
62+
63+
./manage.py dumpdata_advance app_name.model_name --fields=*
64+
65+
66+
Exclude custom fields:
67+
68+
69+
70+
./manage.py dumpdata_advance app_name.model_name --exclude_fields=name
71+
72+
73+
74+
Limit number of exported records:
75+
76+
77+
78+
./manage.py dumpdata_advance app_name.model_name --fields=* --limit=10
79+
80+
81+
Export full file URL:
82+
83+
84+
85+
./manage.py dumpdata_advance app_name.model_name --fields=image --full_url=image
86+
87+
88+
Export from another database than 'default':
89+
90+
91+
92+
./manage.py dumpdata_advance app_name.model_name --database=other_database

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
version="0.0.1",
99
description="Django Manage Command; Output the contents of the database"
1010
" as a fixture of the given format,filter and more features ",
11-
long_description=open(os.path.join(os.path.dirname(__file__), "README.md")).read(),
11+
long_description=open(os.path.join(os.path.dirname(__file__), "README.rst")).read(),
1212
long_description_content_type="text/markdown",
1313
author="Ehsan Safir , Sayed Farid Qattali",
1414
author_email="EhsanSafir@outlook.com , eng.faridqattali@gmail.com ",

0 commit comments

Comments
 (0)