Skip to content

Drf example fixtures #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -47,3 +47,6 @@ pip-delete-this-directory.txt
*.sw*
manage.py
.DS_Store

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


v2.5.0 - Released July 11, 2018
1 change: 1 addition & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ From Source
pip install -r example/requirements.txt
pip install -e .
django-admin migrate --settings=example.settings
django-admin loaddata drf_example --settings=example.settings
django-admin runserver --settings=example.settings


Binary file removed drf_example
Binary file not shown.
124 changes: 124 additions & 0 deletions example/fixtures/drf_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
[
{
"model": "example.blog",
"pk": 1,
"fields": {
"created_at": "2016-05-02T08:27:16.889",
"modified_at": "2016-05-02T08:27:16.889",
"name": "Personal",
"tagline": ""
}
},
{
"model": "example.blog",
"pk": 2,
"fields": {
"created_at": "2016-05-02T08:27:23.871",
"modified_at": "2016-05-02T08:27:23.871",
"name": "Work",
"tagline": ""
}
},
{
"model": "example.author",
"pk": 1,
"fields": {
"created_at": "2016-05-02T10:09:48.277",
"modified_at": "2016-05-02T10:09:48.277",
"name": "Alice",
"email": "[email protected]",
"type": null
}
},
{
"model": "example.author",
"pk": 2,
"fields": {
"created_at": "2016-05-02T10:09:57.133",
"modified_at": "2016-05-02T10:09:57.133",
"name": "Bob",
"email": "[email protected]",
"type": null
}
},
{
"model": "example.authorbio",
"pk": 1,
"fields": {
"created_at": "2016-05-02T10:10:23.429",
"modified_at": "2016-05-02T10:10:23.429",
"author": 1,
"body": "I just want to send messages to Bob."
}
},
{
"model": "example.authorbio",
"pk": 2,
"fields": {
"created_at": "2016-05-02T10:11:30.327",
"modified_at": "2016-05-02T10:11:30.327",
"author": 2,
"body": "I get messages from Alice and send them to Carol"
}
},
{
"model": "example.entry",
"pk": 1,
"fields": {
"created_at": "2016-05-02T10:43:21.271",
"modified_at": "2016-05-02T10:43:21.271",
"blog": 1,
"headline": "This is a test, this is only a test",
"body_text": "And this is the body text for the blog entry. To see comments included in this payload visit: /entries/1?include=comments",
"pub_date": "2015-01-01",
"mod_date": "2015-04-05",
"n_comments": 0,
"n_pingbacks": 0,
"rating": 0,
"authors": [
1
]
}
},
{
"model": "example.entry",
"pk": 2,
"fields": {
"created_at": "2016-05-02T10:44:14.376",
"modified_at": "2016-05-02T10:49:30.150",
"blog": 1,
"headline": "Django, the framework for perfectionists with deadlines",
"body_text": "And this is the body text. Try out includes by using this uri: /entries/2?include=comments,authors,authors.bio",
"pub_date": "2015-05-01",
"mod_date": "2015-09-03",
"n_comments": 0,
"n_pingbacks": 0,
"rating": 0,
"authors": [
2
]
}
},
{
"model": "example.comment",
"pk": 1,
"fields": {
"created_at": "2016-05-02T10:44:35.093",
"modified_at": "2016-05-02T10:44:35.093",
"entry": 1,
"body": "Love this article!",
"author": 2
}
},
{
"model": "example.comment",
"pk": 2,
"fields": {
"created_at": "2016-05-02T10:44:55.482",
"modified_at": "2016-05-02T10:44:55.482",
"entry": 2,
"body": "Frist comment!!!",
"author": null
}
}
]
1 change: 1 addition & 0 deletions example/requirements.txt
Original file line number Diff line number Diff line change
@@ -11,3 +11,4 @@ pyparsing
pytz
six
sqlparse