From ebae577287ff3803011c6539a41164fb25d07e91 Mon Sep 17 00:00:00 2001 From: Zambom Date: Mon, 1 May 2017 23:59:25 -0300 Subject: [PATCH] Changin subject backup --- backup.json | 2 +- file_link/serializers.py | 14 ++++++++++++++ goals/serializers.py | 20 ++++++++++++++++++++ links/serializers.py | 14 ++++++++++++++ pdf_file/serializers.py | 14 ++++++++++++++ subjects/serializers.py | 8 ++++++++ subjects/views.py | 41 ++++++++++++++++++++++++++++++++++------- topics/serializers.py | 8 ++++++++ webpage/serializers.py | 14 ++++++++++++++ youtube_video/serializers.py | 14 ++++++++++++++ 10 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 file_link/serializers.py create mode 100644 goals/serializers.py create mode 100644 links/serializers.py create mode 100644 pdf_file/serializers.py create mode 100644 subjects/serializers.py create mode 100644 topics/serializers.py create mode 100644 webpage/serializers.py create mode 100644 youtube_video/serializers.py diff --git a/backup.json b/backup.json index c582a66..9837c54 100644 --- a/backup.json +++ b/backup.json @@ -1 +1 @@ -[{"model": "topics.topic", "pk": 30, "fields": {"name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "subject": 459, "order": 1, "create_date": "2017-01-17T18:36:32.918Z", "last_update": "2017-01-17T21:48:07.630Z"}}, {"model": "topics.topic", "pk": 32, "fields": {"name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "subject": 459, "order": 2, "create_date": "2017-01-17T18:44:24.976Z", "last_update": "2017-03-08T01:28:52.845Z"}}][{"model": "topics.resource", "pk": 1, "fields": {"_my_subclass": "webpage", "name": "Revenge", "slug": "revenge", "brief_description": "

Here Comes

", "show_window": false, "all_students": false, "visible": true, "order": 1, "topic": 30, "create_date": "2017-01-20T22:42:16.126Z", "last_update": "2017-01-30T18:39:30.100Z", "students": [178, 181], "groups": [], "tags": [44, 45]}}, {"model": "topics.resource", "pk": 14, "fields": {"_my_subclass": "webpage", "name": "Care", "slug": "care", "brief_description": "

One last minute

", "show_window": true, "all_students": false, "visible": true, "order": 2, "topic": 30, "create_date": "2017-01-23T17:59:10.053Z", "last_update": "2017-01-24T21:53:17.119Z", "students": [], "groups": [], "tags": [58, 59]}}, {"model": "topics.resource", "pk": 41, "fields": {"_my_subclass": "filelink", "name": "Secret", "slug": "secret", "brief_description": "

Do we create a modern myth?

", "show_window": true, "all_students": true, "visible": false, "order": 3, "topic": 32, "create_date": "2017-01-24T21:55:44.193Z", "last_update": "2017-01-24T21:55:44.330Z", "students": [], "groups": [], "tags": [93, 94]}}, {"model": "topics.resource", "pk": 3, "fields": {"_my_subclass": "webpage", "name": "Teste 2", "slug": "teste-2", "brief_description": "

Here Comes

", "show_window": true, "all_students": false, "visible": true, "order": 3, "topic": 30, "create_date": "2017-01-23T17:17:28.416Z", "last_update": "2017-01-24T21:53:17.131Z", "students": [178, 181], "groups": [], "tags": [44, 45]}}, {"model": "topics.resource", "pk": 40, "fields": {"_my_subclass": "filelink", "name": "Alive", "slug": "alive", "brief_description": "

Nothern lights

I'm still

", "show_window": true, "all_students": true, "visible": true, "order": 4, "topic": 30, "create_date": "2017-01-24T21:52:58.028Z", "last_update": "2017-01-30T18:33:25.804Z", "students": [], "groups": [], "tags": [91, 92]}}, {"model": "topics.resource", "pk": 42, "fields": {"_my_subclass": "webpage", "name": "History goes", "slug": "history-goes", "brief_description": "

How

", "show_window": false, "all_students": false, "visible": false, "order": 4, "topic": 32, "create_date": "2017-01-24T21:57:13.600Z", "last_update": "2017-01-24T21:57:13.812Z", "students": [178], "groups": [], "tags": [95]}}, {"model": "topics.resource", "pk": 4, "fields": {"_my_subclass": "webpage", "name": "Have", "slug": "have", "brief_description": "

Save me

", "show_window": true, "all_students": false, "visible": true, "order": 5, "topic": 30, "create_date": "2017-01-23T17:31:58.957Z", "last_update": "2017-01-24T21:53:17.155Z", "students": [179, 178], "groups": [], "tags": [46, 47]}}, {"model": "topics.resource", "pk": 21, "fields": {"_my_subclass": "webpage", "name": "Each small candle", "slug": "each-small-candle", "brief_description": "

Uhuh

", "show_window": false, "all_students": false, "visible": true, "order": 6, "topic": 30, "create_date": "2017-01-24T03:16:17.180Z", "last_update": "2017-01-24T21:53:17.164Z", "students": [177, 179], "groups": [], "tags": [71, 72]}}, {"model": "topics.resource", "pk": 5, "fields": {"_my_subclass": "webpage", "name": "Lose you", "slug": "lose-you", "brief_description": "

Save me

", "show_window": true, "all_students": false, "visible": true, "order": 7, "topic": 30, "create_date": "2017-01-23T17:34:29.313Z", "last_update": "2017-01-24T21:53:17.175Z", "students": [179, 178], "groups": [], "tags": [46, 47]}}, {"model": "topics.resource", "pk": 16, "fields": {"_my_subclass": "webpage", "name": "Sing", "slug": "sing", "brief_description": "

Talking about

", "show_window": false, "all_students": false, "visible": false, "order": 8, "topic": 30, "create_date": "2017-01-23T22:10:39.437Z", "last_update": "2017-01-24T21:53:17.197Z", "students": [177, 178], "groups": [], "tags": [62, 63]}}, {"model": "topics.resource", "pk": 49, "fields": {"_my_subclass": "webpage", "name": "Testes", "slug": "testes", "brief_description": "

asd

", "show_window": false, "all_students": false, "visible": true, "order": 9, "topic": 30, "create_date": "2017-01-30T18:38:25.741Z", "last_update": "2017-01-30T18:38:25.878Z", "students": [179], "groups": [], "tags": [99]}}, {"model": "topics.resource", "pk": 50, "fields": {"_my_subclass": "webpage", "name": "Yellow", "slug": "yellow", "brief_description": "

Vber

", "show_window": false, "all_students": false, "visible": true, "order": 10, "topic": 30, "create_date": "2017-01-30T18:39:04.914Z", "last_update": "2017-01-30T18:39:05.212Z", "students": [180], "groups": [], "tags": [99]}}, {"model": "topics.resource", "pk": 51, "fields": {"_my_subclass": "ytvideo", "name": "System", "slug": "system", "brief_description": "

Gotta

", "show_window": true, "all_students": true, "visible": true, "order": 11, "topic": 30, "create_date": "2017-02-01T21:03:21.123Z", "last_update": "2017-02-02T23:08:32.570Z", "students": [], "groups": [], "tags": [103, 104]}}, {"model": "topics.resource", "pk": 53, "fields": {"_my_subclass": "link", "name": "Sorry", "slug": "sorry", "brief_description": "

Hellor

", "show_window": false, "all_students": true, "visible": true, "order": 12, "topic": 30, "create_date": "2017-02-02T18:59:06.159Z", "last_update": "2017-02-02T18:59:06.270Z", "students": [], "groups": [], "tags": [106]}}, {"model": "topics.resource", "pk": 56, "fields": {"_my_subclass": "pdffile", "name": "Legend", "slug": "legend", "brief_description": "", "show_window": false, "all_students": true, "visible": true, "order": 13, "topic": 30, "create_date": "2017-02-09T18:29:12.935Z", "last_update": "2017-02-09T18:29:13.410Z", "students": [], "groups": [], "tags": [99]}}, {"model": "topics.resource", "pk": 57, "fields": {"_my_subclass": "link", "name": "Unravel", "slug": "unravel", "brief_description": "

Co asseru

", "show_window": true, "all_students": true, "visible": true, "order": 14, "topic": 30, "create_date": "2017-02-12T04:18:39.836Z", "last_update": "2017-02-12T04:18:40.083Z", "students": [], "groups": [], "tags": [109]}}, {"model": "topics.resource", "pk": 58, "fields": {"_my_subclass": "webpage", "name": "Berry the castle", "slug": "berry-the-castle", "brief_description": "", "show_window": false, "all_students": true, "visible": true, "order": 15, "topic": 30, "create_date": "2017-02-23T15:22:21.044Z", "last_update": "2017-02-23T15:22:21.371Z", "students": [], "groups": [], "tags": [112]}}, {"model": "topics.resource", "pk": 59, "fields": {"_my_subclass": "webpage", "name": "What you get", "slug": "what-you-get", "brief_description": "

To me

", "show_window": false, "all_students": true, "visible": true, "order": 16, "topic": 30, "create_date": "2017-02-23T15:23:56.414Z", "last_update": "2017-02-23T15:23:56.482Z", "students": [], "groups": [], "tags": [109]}}, {"model": "topics.resource", "pk": 66, "fields": {"_my_subclass": "webpage", "name": "Last Stand", "slug": "last-stand", "brief_description": "

For the grace of the might of the Lord    

", "show_window": false, "all_students": true, "visible": true, "order": 17, "topic": 30, "create_date": "2017-02-24T20:31:26.650Z", "last_update": "2017-02-24T20:31:26.778Z", "students": [], "groups": [], "tags": [116]}}, {"model": "topics.resource", "pk": 68, "fields": {"_my_subclass": "webpage", "name": "Angels calling", "slug": "angels-calling", "brief_description": "

Falling

", "show_window": false, "all_students": true, "visible": true, "order": 18, "topic": 30, "create_date": "2017-02-24T20:47:51.687Z", "last_update": "2017-02-25T01:35:19.427Z", "students": [], "groups": [], "tags": [118]}}, {"model": "topics.resource", "pk": 70, "fields": {"_my_subclass": "goals", "name": "Snuff", "slug": "snuff", "brief_description": "

Deserve to have you

", "show_window": false, "all_students": true, "visible": true, "order": 19, "topic": 30, "create_date": "2017-03-01T19:07:07.980Z", "last_update": "2017-03-03T01:16:22.746Z", "students": [], "groups": [], "tags": [121, 122]}}, {"model": "topics.resource", "pk": 73, "fields": {"_my_subclass": "filelink", "name": "Lies", "slug": "lies", "brief_description": "", "show_window": false, "all_students": false, "visible": true, "order": 20, "topic": 30, "create_date": "2017-04-26T03:03:38.089Z", "last_update": "2017-04-26T03:03:38.531Z", "students": [], "groups": [], "tags": [125]}}] \ No newline at end of file +[{"id": 6, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "order": 2, "create_date": "2017-01-17T18:44:24.976186Z", "last_update": "2017-03-08T01:28:52.845818Z"}, "tags": [{"id": 48, "name": "anything"}, {"id": 49, "name": "lsoe"}], "_my_subclass": "webpage", "name": "Doug", "slug": "doug", "brief_description": "

Today

", "show_window": true, "all_students": false, "visible": false, "order": 1, "create_date": "2017-01-23T17:36:14.900287Z", "last_update": "2017-01-24T17:33:39.433016Z", "content": "Freaky man"}, {"id": 1, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 44, "name": "rvenge"}, {"id": 45, "name": "destruct"}], "_my_subclass": "webpage", "name": "Revenge", "slug": "revenge", "brief_description": "

Here Comes

", "show_window": false, "all_students": false, "visible": true, "order": 1, "create_date": "2017-01-20T22:42:16.126657Z", "last_update": "2017-01-30T18:39:30.100600Z", "content": "

Listen Dammit

I do know how to make it better thoug

"}, {"id": 14, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 58, "name": "survive"}, {"id": 59, "name": "brave"}], "_my_subclass": "webpage", "name": "Care", "slug": "care", "brief_description": "

One last minute

", "show_window": true, "all_students": false, "visible": true, "order": 2, "create_date": "2017-01-23T17:59:10.053614Z", "last_update": "2017-01-24T21:53:17.119881Z", "content": "You don't really"}, {"id": 20, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "order": 2, "create_date": "2017-01-17T18:44:24.976186Z", "last_update": "2017-03-08T01:28:52.845818Z"}, "tags": [{"id": 69, "name": "noine"}, {"id": 70, "name": "nine"}], "_my_subclass": "webpage", "name": "Myself", "slug": "myself", "brief_description": "

Is up to me

", "show_window": false, "all_students": true, "visible": false, "order": 2, "create_date": "2017-01-23T22:59:42.592301Z", "last_update": "2017-01-24T17:34:20.147284Z", "content": "Sold my soul
I brought this all upon myself
Dont stop me now!!
"}, {"id": 3, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 44, "name": "rvenge"}, {"id": 45, "name": "destruct"}], "_my_subclass": "webpage", "name": "Teste 2", "slug": "teste-2", "brief_description": "

Here Comes

", "show_window": true, "all_students": false, "visible": true, "order": 3, "create_date": "2017-01-23T17:17:28.416904Z", "last_update": "2017-01-24T21:53:17.131082Z", "content": "Listen Dammit"}, {"id": 42, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "order": 2, "create_date": "2017-01-17T18:44:24.976186Z", "last_update": "2017-03-08T01:28:52.845818Z"}, "tags": [{"id": 95, "name": "history"}], "_my_subclass": "webpage", "name": "History goes", "slug": "history-goes", "brief_description": "

How

", "show_window": false, "all_students": false, "visible": false, "order": 4, "create_date": "2017-01-24T21:57:13.600718Z", "last_update": "2017-01-24T21:57:13.812438Z", "content": "

ON

"}, {"id": 4, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 46, "name": "tears"}, {"id": 47, "name": "rain"}], "_my_subclass": "webpage", "name": "Have", "slug": "have", "brief_description": "

Save me

", "show_window": true, "all_students": false, "visible": true, "order": 5, "create_date": "2017-01-23T17:31:58.957439Z", "last_update": "2017-01-24T21:53:17.155196Z", "content": "Haven't"}, {"id": 21, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 71, "name": "candle"}, {"id": 72, "name": "mass"}], "_my_subclass": "webpage", "name": "Each small candle", "slug": "each-small-candle", "brief_description": "

Uhuh

", "show_window": false, "all_students": false, "visible": true, "order": 6, "create_date": "2017-01-24T03:16:17.180365Z", "last_update": "2017-01-24T21:53:17.164135Z", "content": "

Lights a corner of the dark

"}, {"id": 5, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 46, "name": "tears"}, {"id": 47, "name": "rain"}], "_my_subclass": "webpage", "name": "Lose you", "slug": "lose-you", "brief_description": "

Save me

", "show_window": true, "all_students": false, "visible": true, "order": 7, "create_date": "2017-01-23T17:34:29.313661Z", "last_update": "2017-01-24T21:53:17.175261Z", "content": "Haven't you heard about the sirens going down"}, {"id": 16, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 62, "name": "sing"}, {"id": 63, "name": "loud"}], "_my_subclass": "webpage", "name": "Sing", "slug": "sing", "brief_description": "

Talking about

", "show_window": false, "all_students": false, "visible": false, "order": 8, "create_date": "2017-01-23T22:10:39.437832Z", "last_update": "2017-01-24T21:53:17.197911Z", "content": "Sing sing"}, {"id": 49, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 99, "name": ""}], "_my_subclass": "webpage", "name": "Testes", "slug": "testes", "brief_description": "

asd

", "show_window": false, "all_students": false, "visible": true, "order": 9, "create_date": "2017-01-30T18:38:25.741186Z", "last_update": "2017-01-30T18:38:25.878442Z", "content": "

COmon

"}, {"id": 50, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 99, "name": ""}], "_my_subclass": "webpage", "name": "Yellow", "slug": "yellow", "brief_description": "

Vber

", "show_window": false, "all_students": false, "visible": true, "order": 10, "create_date": "2017-01-30T18:39:04.914450Z", "last_update": "2017-01-30T18:39:05.212499Z", "content": "

Flicker Berat

"}, {"id": 58, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 112, "name": "castle"}], "_my_subclass": "webpage", "name": "Berry the castle", "slug": "berry-the-castle", "brief_description": "", "show_window": false, "all_students": true, "visible": true, "order": 15, "create_date": "2017-02-23T15:22:21.044556Z", "last_update": "2017-02-23T15:22:21.371782Z", "content": "

Crush crush crush

"}, {"id": 59, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 109, "name": "teste"}], "_my_subclass": "webpage", "name": "What you get", "slug": "what-you-get", "brief_description": "

To me

", "show_window": false, "all_students": true, "visible": true, "order": 16, "create_date": "2017-02-23T15:23:56.414396Z", "last_update": "2017-02-23T15:23:56.482582Z", "content": "

Let your heart with

"}, {"id": 66, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 116, "name": "Lord"}], "_my_subclass": "webpage", "name": "Last Stand", "slug": "last-stand", "brief_description": "

For the grace of the might of the Lord    

", "show_window": false, "all_students": true, "visible": true, "order": 17, "create_date": "2017-02-24T20:31:26.650857Z", "last_update": "2017-02-24T20:31:26.778340Z", "content": "

Twenty Seven

"}, {"id": 68, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 118, "name": "calling"}], "_my_subclass": "webpage", "name": "Angels calling", "slug": "angels-calling", "brief_description": "

Falling

", "show_window": false, "all_students": true, "visible": true, "order": 18, "create_date": "2017-02-24T20:47:51.687147Z", "last_update": "2017-02-25T01:35:19.427849Z", "content": "

Your name

"}][{"id": 51, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 103, "name": "mirror"}, {"id": 104, "name": "to do"}], "_my_subclass": "ytvideo", "name": "System", "slug": "system", "brief_description": "

Gotta

", "show_window": true, "all_students": true, "visible": true, "order": 11, "create_date": "2017-02-01T21:03:21.123568Z", "last_update": "2017-02-02T23:08:32.570997Z", "url": "https://www.youtube.com/embed/qOrXWhmUbJ0"}][{"id": 41, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "order": 2, "create_date": "2017-01-17T18:44:24.976186Z", "last_update": "2017-03-08T01:28:52.845818Z"}, "tags": [{"id": 93, "name": "last"}, {"id": 94, "name": "mistake"}], "_my_subclass": "filelink", "name": "Secret", "slug": "secret", "brief_description": "

Do we create a modern myth?

", "show_window": true, "all_students": true, "visible": false, "order": 3, "create_date": "2017-01-24T21:55:44.193797Z", "last_update": "2017-01-24T21:55:44.330406Z", "file_content": "/uploads/files/formulariobolsista.doc.docx"}, {"id": 40, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 91, "name": "end"}, {"id": 92, "name": "tonight"}], "_my_subclass": "filelink", "name": "Alive", "slug": "alive", "brief_description": "

Nothern lights

I'm still

", "show_window": true, "all_students": true, "visible": true, "order": 4, "create_date": "2017-01-24T21:52:58.028122Z", "last_update": "2017-01-30T18:33:25.804307Z", "file_content": "/uploads/files/index.html"}, {"id": 46, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "order": 2, "create_date": "2017-01-17T18:44:24.976186Z", "last_update": "2017-03-08T01:28:52.845818Z"}, "tags": [{"id": 100, "name": "just"}, {"id": 101, "name": "game"}], "_my_subclass": "filelink", "name": "Personal", "slug": "personal", "brief_description": "

Pray All I can do

Taskani

", "show_window": false, "all_students": false, "visible": false, "order": 6, "create_date": "2017-01-25T02:21:38.618190Z", "last_update": "2017-01-25T02:24:26.061727Z", "file_content": "/uploads/files/jutificativa_voto.pdf"}, {"id": 73, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 125, "name": "Zafkiel"}], "_my_subclass": "filelink", "name": "Lies", "slug": "lies", "brief_description": "", "show_window": false, "all_students": false, "visible": true, "order": 20, "create_date": "2017-04-26T03:03:38.089353Z", "last_update": "2017-04-26T03:03:38.531148Z", "file_content": "/uploads/files/kurumi.png"}][{"id": 53, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 106, "name": "otherside"}], "_my_subclass": "link", "name": "Sorry", "slug": "sorry", "brief_description": "

Hellor

", "show_window": false, "all_students": true, "visible": true, "order": 12, "create_date": "2017-02-02T18:59:06.159653Z", "last_update": "2017-02-02T18:59:06.270167Z", "link_url": "https://www.youtube.com/embed/qOrXWhmUbJ0"}, {"id": 57, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 109, "name": "teste"}], "_my_subclass": "link", "name": "Unravel", "slug": "unravel", "brief_description": "

Co asseru

", "show_window": true, "all_students": true, "visible": true, "order": 14, "create_date": "2017-02-12T04:18:39.836818Z", "last_update": "2017-02-12T04:18:40.083226Z", "link_url": "http://stackoverflow.com/questions/813418/django-set-field-value-after-a-form-is-initialized"}][{"id": 56, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 99, "name": ""}], "_my_subclass": "pdffile", "name": "Legend", "slug": "legend", "brief_description": "", "show_window": false, "all_students": true, "visible": true, "order": 13, "create_date": "2017-02-09T18:29:12.935873Z", "last_update": "2017-02-09T18:29:13.410469Z", "file": "/uploads/files/egz_Ez4GoPW.pdf"}][{"id": 71, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "

TIme to

", "repository": false, "visible": true, "order": 2, "create_date": "2017-01-17T18:44:24.976186Z", "last_update": "2017-03-08T01:28:52.845818Z"}, "tags": [{"id": 123, "name": "wastelands"}, {"id": 124, "name": "disapear"}], "item_goal": [{"id": 6, "description": "Wastelands", "ref_value": 50, "order": 1}, {"id": 7, "description": "Arms with no weapons", "ref_value": 55, "order": 2}], "_my_subclass": "goals", "name": "Future", "slug": "future", "brief_description": "", "show_window": false, "all_students": true, "visible": true, "order": 6, "create_date": "2017-03-06T20:11:11.156470Z", "last_update": "2017-03-08T01:29:03.155215Z", "presentation": "

Stands away

", "limit_submission_date": "2017-03-11T20:10:00Z"}, {"id": 70, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "

Testing

", "repository": true, "visible": false, "order": 1, "create_date": "2017-01-17T18:36:32.918370Z", "last_update": "2017-01-17T21:48:07.630468Z"}, "tags": [{"id": 121, "name": "megumin"}, {"id": 122, "name": "kurumin"}], "item_goal": [{"id": 3, "description": "Let me go", "ref_value": 57, "order": 1}, {"id": 4, "description": "Run away", "ref_value": 70, "order": 2}, {"id": 5, "description": "Explosiom", "ref_value": 89, "order": 3}], "_my_subclass": "goals", "name": "Snuff", "slug": "snuff", "brief_description": "

Deserve to have you

", "show_window": false, "all_students": true, "visible": true, "order": 19, "create_date": "2017-03-01T19:07:07.980858Z", "last_update": "2017-03-03T01:16:22.746523Z", "presentation": "

Resembles rage again...

", "limit_submission_date": "2017-03-02T21:05:00Z"}] \ No newline at end of file diff --git a/file_link/serializers.py b/file_link/serializers.py new file mode 100644 index 0000000..9f7ca4b --- /dev/null +++ b/file_link/serializers.py @@ -0,0 +1,14 @@ +from rest_framework import serializers + +from subjects.serializers import TagSerializer +from topics.serializers import TopicSerializer + +from .models import FileLink + +class SimpleFileLinkSerializer(serializers.ModelSerializer): + topic = TopicSerializer() + tags = TagSerializer(many = True) + + class Meta: + model = FileLink + exclude = ('students', 'groups',) diff --git a/goals/serializers.py b/goals/serializers.py new file mode 100644 index 0000000..416b942 --- /dev/null +++ b/goals/serializers.py @@ -0,0 +1,20 @@ +from rest_framework import serializers + +from subjects.serializers import TagSerializer +from topics.serializers import TopicSerializer + +from .models import Goals, GoalItem + +class GoalItemSerializer(serializers.ModelSerializer): + class Meta: + model = GoalItem + exclude = ('goal',) + +class SimpleGoalSerializer(serializers.ModelSerializer): + topic = TopicSerializer() + tags = TagSerializer(many = True) + item_goal = GoalItemSerializer(many = True) + + class Meta: + model = Goals + exclude = ('students', 'groups',) diff --git a/links/serializers.py b/links/serializers.py new file mode 100644 index 0000000..c356d66 --- /dev/null +++ b/links/serializers.py @@ -0,0 +1,14 @@ +from rest_framework import serializers + +from subjects.serializers import TagSerializer +from topics.serializers import TopicSerializer + +from .models import Link + +class SimpleLinkSerializer(serializers.ModelSerializer): + topic = TopicSerializer() + tags = TagSerializer(many = True) + + class Meta: + model = Link + exclude = ('students', 'groups',) diff --git a/pdf_file/serializers.py b/pdf_file/serializers.py new file mode 100644 index 0000000..81161a8 --- /dev/null +++ b/pdf_file/serializers.py @@ -0,0 +1,14 @@ +from rest_framework import serializers + +from subjects.serializers import TagSerializer +from topics.serializers import TopicSerializer + +from .models import PDFFile + +class SimplePDFFileSerializer(serializers.ModelSerializer): + topic = TopicSerializer() + tags = TagSerializer(many = True) + + class Meta: + model = PDFFile + exclude = ('students', 'groups',) diff --git a/subjects/serializers.py b/subjects/serializers.py new file mode 100644 index 0000000..bb37ed3 --- /dev/null +++ b/subjects/serializers.py @@ -0,0 +1,8 @@ +from rest_framework import serializers + +from .models import Tag + +class TagSerializer(serializers.ModelSerializer): + class Meta: + model = Tag + fields = '__all__' \ No newline at end of file diff --git a/subjects/views.py b/subjects/views.py index e265fde..b6262a3 100644 --- a/subjects/views.py +++ b/subjects/views.py @@ -35,10 +35,24 @@ from news.models import News import os import zipfile +import json from io import BytesIO from itertools import chain from django.core import serializers -from django.contrib.admin.utils import NestedObjects +from rest_framework.renderers import JSONRenderer + +from file_link.serializers import SimpleFileLinkSerializer +from file_link.models import FileLink +from goals.serializers import SimpleGoalSerializer +from goals.models import Goals +from links.serializers import SimpleLinkSerializer +from links.models import Link +from pdf_file.serializers import SimplePDFFileSerializer +from pdf_file.models import PDFFile +from youtube_video.serializers import SimpleYTVideoSerializer +from youtube_video.models import YTVideo +from webpage.serializers import SimpleWebpageSerializer +from webpage.models import Webpage from amadeus.permissions import has_category_permissions, has_subject_permissions, has_subject_view_permissions, has_resource_permissions @@ -758,8 +772,6 @@ class Backup(LoginRequiredMixin, ListView): @login_required def realize_backup(request): - #collector = NestedObjects(using="default") # database name - #collector.collect(list(Resource.objects.filter(visible = True))) resources_ids = request.POST.getlist("resource[]") resource_files_subdir = "files" @@ -785,13 +797,28 @@ def realize_backup(request): # Add file, at correct path zf.write(resource.pdffile.file.path, zip_path) - topics = Topic.objects.filter(resource_topic__id__in = resources_ids).distinct() + webpages = Webpage.objects.filter(id__in = resources_ids) + ytvideos = YTVideo.objects.filter(id__in = resources_ids) + filelinks = FileLink.objects.filter(id__in = resources_ids) + links = Link.objects.filter(id__in = resources_ids) + pdffiles = PDFFile.objects.filter(id__in = resources_ids) + goals = Goals.objects.filter(id__in = resources_ids) file = open("backup.json", "w") - json_serializer = serializers.get_serializer('json')() - json_serializer.serialize(topics, stream = file) - json_serializer.serialize(resources, stream = file) + serializer_w = SimpleWebpageSerializer(webpages, many = True) + serializer_y = SimpleYTVideoSerializer(ytvideos, many = True) + serializer_f = SimpleFileLinkSerializer(filelinks, many = True) + serializer_l = SimpleLinkSerializer(links, many = True) + serializer_p = SimplePDFFileSerializer(pdffiles, many = True) + serializer_g = SimpleGoalSerializer(goals, many = True) + + json.dump(serializer_w.data, file) + json.dump(serializer_y.data, file) + json.dump(serializer_f.data, file) + json.dump(serializer_l.data, file) + json.dump(serializer_p.data, file) + json.dump(serializer_g.data, file) file.close() diff --git a/topics/serializers.py b/topics/serializers.py new file mode 100644 index 0000000..50b2e24 --- /dev/null +++ b/topics/serializers.py @@ -0,0 +1,8 @@ +from rest_framework import serializers + +from .models import Topic, Resource + +class TopicSerializer(serializers.ModelSerializer): + class Meta: + model = Topic + exclude = ('subject',) \ No newline at end of file diff --git a/webpage/serializers.py b/webpage/serializers.py new file mode 100644 index 0000000..9e15dca --- /dev/null +++ b/webpage/serializers.py @@ -0,0 +1,14 @@ +from rest_framework import serializers + +from subjects.serializers import TagSerializer +from topics.serializers import TopicSerializer + +from .models import Webpage + +class SimpleWebpageSerializer(serializers.ModelSerializer): + topic = TopicSerializer() + tags = TagSerializer(many = True) + + class Meta: + model = Webpage + exclude = ('students', 'groups',) diff --git a/youtube_video/serializers.py b/youtube_video/serializers.py new file mode 100644 index 0000000..df4df49 --- /dev/null +++ b/youtube_video/serializers.py @@ -0,0 +1,14 @@ +from rest_framework import serializers + +from subjects.serializers import TagSerializer +from topics.serializers import TopicSerializer + +from .models import YTVideo + +class SimpleYTVideoSerializer(serializers.ModelSerializer): + topic = TopicSerializer() + tags = TagSerializer(many = True) + + class Meta: + model = YTVideo + exclude = ('students', 'groups',) -- libgit2 0.21.2