Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 95e6d8d

Browse files
authored
Drf example fixtures (django-json-api#462)
* replace binary drf_example sqlite3 db file with fixture
1 parent 8821b99 commit 95e6d8d

File tree

6 files changed

+130
-0
lines changed

6 files changed

+130
-0
lines changed

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ pip-delete-this-directory.txt
4747
*.sw*
4848
manage.py
4949
.DS_Store
50+
51+
# example database
52+
drf_example

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Add sorting configuration to `REST_FRAMEWORK` as defined in [json api spec](http://jsonapi.org/format/#fetching-sorting)
55
* Add `HyperlinkedRelatedField` and `SerializerMethodHyperlinkedRelatedField`. See [usage docs](docs/usage.md#related-fields)
66
* Add related urls support. See [usage docs](docs/usage.md#related-urls)
7+
* Replaced binary `drf_example` sqlite3 db with a [fixture](example/fixtures/drf_example.yaml). See [usage docs](docs/usage.md#running-the-example-app).
78

89

910
v2.5.0 - Released July 11, 2018

‎docs/getting-started.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ From Source
7575
pip install -r example/requirements.txt
7676
pip install -e .
7777
django-admin migrate --settings=example.settings
78+
django-admin loaddata drf_example --settings=example.settings
7879
django-admin runserver --settings=example.settings
7980

8081

‎drf_example‎

-79 KB
Binary file not shown.

‎example/fixtures/drf_example.json‎

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
[
2+
{
3+
"model": "example.blog",
4+
"pk": 1,
5+
"fields": {
6+
"created_at": "2016年05月02日T08:27:16.889",
7+
"modified_at": "2016年05月02日T08:27:16.889",
8+
"name": "Personal",
9+
"tagline": ""
10+
}
11+
},
12+
{
13+
"model": "example.blog",
14+
"pk": 2,
15+
"fields": {
16+
"created_at": "2016年05月02日T08:27:23.871",
17+
"modified_at": "2016年05月02日T08:27:23.871",
18+
"name": "Work",
19+
"tagline": ""
20+
}
21+
},
22+
{
23+
"model": "example.author",
24+
"pk": 1,
25+
"fields": {
26+
"created_at": "2016年05月02日T10:09:48.277",
27+
"modified_at": "2016年05月02日T10:09:48.277",
28+
"name": "Alice",
29+
"email": "alice@example.com",
30+
"type": null
31+
}
32+
},
33+
{
34+
"model": "example.author",
35+
"pk": 2,
36+
"fields": {
37+
"created_at": "2016年05月02日T10:09:57.133",
38+
"modified_at": "2016年05月02日T10:09:57.133",
39+
"name": "Bob",
40+
"email": "bob@example.com",
41+
"type": null
42+
}
43+
},
44+
{
45+
"model": "example.authorbio",
46+
"pk": 1,
47+
"fields": {
48+
"created_at": "2016年05月02日T10:10:23.429",
49+
"modified_at": "2016年05月02日T10:10:23.429",
50+
"author": 1,
51+
"body": "I just want to send messages to Bob."
52+
}
53+
},
54+
{
55+
"model": "example.authorbio",
56+
"pk": 2,
57+
"fields": {
58+
"created_at": "2016年05月02日T10:11:30.327",
59+
"modified_at": "2016年05月02日T10:11:30.327",
60+
"author": 2,
61+
"body": "I get messages from Alice and send them to Carol"
62+
}
63+
},
64+
{
65+
"model": "example.entry",
66+
"pk": 1,
67+
"fields": {
68+
"created_at": "2016年05月02日T10:43:21.271",
69+
"modified_at": "2016年05月02日T10:43:21.271",
70+
"blog": 1,
71+
"headline": "This is a test, this is only a test",
72+
"body_text": "And this is the body text for the blog entry. To see comments included in this payload visit: /entries/1?include=comments",
73+
"pub_date": "2015年01月01日",
74+
"mod_date": "2015年04月05日",
75+
"n_comments": 0,
76+
"n_pingbacks": 0,
77+
"rating": 0,
78+
"authors": [
79+
1
80+
]
81+
}
82+
},
83+
{
84+
"model": "example.entry",
85+
"pk": 2,
86+
"fields": {
87+
"created_at": "2016年05月02日T10:44:14.376",
88+
"modified_at": "2016年05月02日T10:49:30.150",
89+
"blog": 1,
90+
"headline": "Django, the framework for perfectionists with deadlines",
91+
"body_text": "And this is the body text. Try out includes by using this uri: /entries/2?include=comments,authors,authors.bio",
92+
"pub_date": "2015年05月01日",
93+
"mod_date": "2015年09月03日",
94+
"n_comments": 0,
95+
"n_pingbacks": 0,
96+
"rating": 0,
97+
"authors": [
98+
2
99+
]
100+
}
101+
},
102+
{
103+
"model": "example.comment",
104+
"pk": 1,
105+
"fields": {
106+
"created_at": "2016年05月02日T10:44:35.093",
107+
"modified_at": "2016年05月02日T10:44:35.093",
108+
"entry": 1,
109+
"body": "Love this article!",
110+
"author": 2
111+
}
112+
},
113+
{
114+
"model": "example.comment",
115+
"pk": 2,
116+
"fields": {
117+
"created_at": "2016年05月02日T10:44:55.482",
118+
"modified_at": "2016年05月02日T10:44:55.482",
119+
"entry": 2,
120+
"body": "Frist comment!!!",
121+
"author": null
122+
}
123+
}
124+
]

‎example/requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ pyparsing
1111
pytz
1212
six
1313
sqlparse
14+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /