Commit 25c98d9bfd110d2530250411bf6090d768d9645d

Authored by Zambom
1 parent ebae5772

Adding resource pendencies and the possibility to include users data in subject backup

1 -[{"id": 6, "topic": {"id": 32, "name": "Now Invisble", "slug": "now-invisble", "description": "<p>TIme to</p>", "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": "<p>Today</p>", "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": "<p>Testing</p>", "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": "<p>Here Comes</p>", "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": "<p>Listen Dammit</p><p>I do know how to make it better thoug</p>"}, {"id": 14, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>One last minute</p>", "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": "<p>TIme to</p>", "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": "<p>Is up to me</p>", "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": "<title>Sold my soul</title><h5>I brought this all <em>upon myself<br>Dont stop me now!!</em></h5>"}, {"id": 3, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Here Comes</p>", "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": "<p>TIme to</p>", "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": "<p>How</p>", "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": "<p>ON</p>"}, {"id": 4, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Save me</p>", "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": "<p>Testing</p>", "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": "<p>Uhuh</p>", "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": "<p>Lights a corner of the dark</p>"}, {"id": 5, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Save me</p>", "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 <b>you heard <i>about the sirens <u>going down</u></i></b>"}, {"id": 16, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Talking about</p>", "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": "<p>Testing</p>", "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": "<p>asd</p>", "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": "<p>COmon</p>"}, {"id": 50, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Vber</p>", "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": "<p>Flicker Berat</p>"}, {"id": 58, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Crush crush crush<br></p>"}, {"id": 59, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>To me</p>", "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": "<p>Let your heart with</p>"}, {"id": 66, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>For the grace of the might of the Lord&nbsp;&nbsp;&nbsp;&nbsp;</p>", "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": "<p>Twenty Seven</p>"}, {"id": 68, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Falling</p>", "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": "<p>Your name</p>"}][{"id": 51, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Gotta</p>", "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": "<p>TIme to</p>", "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": "<p>Do we create a modern myth?</p>", "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": "<p>Testing</p>", "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": "<p>Nothern lights</p><p>I'm still</p>", "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": "<p>TIme to</p>", "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": "<p>Pray All I can do</p><p>Taskani</p>", "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": "<p>Testing</p>", "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": "<p>Testing</p>", "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": "<p>Hellor</p>", "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": "<p>Testing</p>", "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": "<p>Co asseru</p>", "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": "<p>Testing</p>", "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": "<p>TIme to</p>", "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": "<p>Stands away</p>", "limit_submission_date": "2017-03-11T20:10:00Z"}, {"id": 70, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": "<p>Deserve to have you</p>", "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": "<p>Resembles rage again...</p>", "limit_submission_date": "2017-03-02T21:05:00Z"}]  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +[{"id": 1, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 1, "action": "create", "begin_date": "2017-01-21T23:35:00Z", "end_date": null, "limit_date": null}, {"id": 2, "action": "view", "begin_date": "2017-01-20T23:35:00Z", "end_date": "2017-01-31T23:35:00Z", "limit_date": null}], "_my_subclass": "webpage", "name": "Revenge", "slug": "revenge", "brief_description": "<p>Here Comes</p>", "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": "<p>Listen Dammit</p><p>I do know how to make it better thoug</p>"}, {"id": 14, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_my_subclass": "webpage", "name": "Care", "slug": "care", "brief_description": "<p>One last minute</p>", "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": 3, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 5, "action": "create", "begin_date": "2017-01-24T23:35:00Z", "end_date": null, "limit_date": null}, {"id": 6, "action": "view", "begin_date": "2017-01-24T23:35:00Z", "end_date": "2017-01-31T23:35:00Z", "limit_date": null}], "_my_subclass": "webpage", "name": "Teste 2", "slug": "teste-2", "brief_description": "<p>Here Comes</p>", "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": 4, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_my_subclass": "webpage", "name": "Have", "slug": "have", "brief_description": "<p>Save me</p>", "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": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 7, "action": "view", "begin_date": "2017-01-25T04:07:00Z", "end_date": "2017-02-02T04:07:00Z", "limit_date": null}], "_my_subclass": "webpage", "name": "Each small candle", "slug": "each-small-candle", "brief_description": "<p>Uhuh</p>", "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": "<p>Lights a corner of the dark</p>"}, {"id": 5, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_my_subclass": "webpage", "name": "Lose you", "slug": "lose-you", "brief_description": "<p>Save me</p>", "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 <b>you heard <i>about the sirens <u>going down</u></i></b>"}, {"id": 16, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_my_subclass": "webpage", "name": "Sing", "slug": "sing", "brief_description": "<p>Talking about</p>", "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": "<p>Testing</p>", "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": ""}], "pendencies_resource": [{"id": 22, "action": "view", "begin_date": "2017-01-31T19:38:00Z", "end_date": null, "limit_date": null}], "_my_subclass": "webpage", "name": "Testes", "slug": "testes", "brief_description": "<p>asd</p>", "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": "<p>COmon</p>"}, {"id": 50, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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": ""}], "pendencies_resource": [{"id": 23, "action": "view", "begin_date": "2017-02-03T19:38:00Z", "end_date": null, "limit_date": null}], "_my_subclass": "webpage", "name": "Yellow", "slug": "yellow", "brief_description": "<p>Vber</p>", "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": "<p>Flicker Berat</p>"}, {"id": 58, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 27, "action": "view", "begin_date": null, "end_date": null, "limit_date": null}], "_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": "<p>Crush crush crush<br></p>"}, {"id": 59, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 28, "action": "view", "begin_date": null, "end_date": null, "limit_date": null}], "_my_subclass": "webpage", "name": "What you get", "slug": "what-you-get", "brief_description": "<p>To me</p>", "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": "<p>Let your heart with</p>"}, {"id": 66, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 30, "action": "view", "begin_date": null, "end_date": null, "limit_date": null}], "_my_subclass": "webpage", "name": "Last Stand", "slug": "last-stand", "brief_description": "<p>For the grace of the might of the Lord&nbsp;&nbsp;&nbsp;&nbsp;</p>", "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": "<p>Twenty Seven</p>"}, {"id": 68, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 31, "action": "view", "begin_date": "2017-02-28T23:01:00Z", "end_date": "2017-03-01T23:02:00Z", "limit_date": null}], "_my_subclass": "webpage", "name": "Angels calling", "slug": "angels-calling", "brief_description": "<p>Falling</p>", "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": "<p>Your name</p>"}][{"id": 51, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 24, "action": "view", "begin_date": "2017-02-01T21:59:00Z", "end_date": null, "limit_date": null}], "_my_subclass": "ytvideo", "name": "System", "slug": "system", "brief_description": "<p>Gotta</p>", "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": 40, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [{"id": 21, "action": "view", "begin_date": "2017-01-31T19:33:00Z", "end_date": null, "limit_date": null}], "_my_subclass": "filelink", "name": "Alive", "slug": "alive", "brief_description": "<p>Nothern lights</p><p>I'm still</p>", "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": 73, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_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": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_my_subclass": "link", "name": "Sorry", "slug": "sorry", "brief_description": "<p>Hellor</p>", "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": "<p>Testing</p>", "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"}], "pendencies_resource": [], "_my_subclass": "link", "name": "Unravel", "slug": "unravel", "brief_description": "<p>Co asseru</p>", "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": "<p>Testing</p>", "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": ""}], "pendencies_resource": [], "_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": 70, "topic": {"id": 30, "name": "Reposit\u00f3rio", "slug": "repositorio", "description": "<p>Testing</p>", "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}], "pendencies_resource": [{"id": 33, "action": "view", "begin_date": "2017-03-01T19:06:00Z", "end_date": "2017-03-02T00:06:00Z", "limit_date": "2017-03-02T19:06:00Z"}], "_my_subclass": "goals", "name": "Snuff", "slug": "snuff", "brief_description": "<p>Deserve to have you</p>", "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": "<p>Resembles rage again...</p>", "limit_submission_date": "2017-03-02T21:05:00Z"}]
3 \ No newline at end of file 3 \ No newline at end of file
file_link/serializers.py
@@ -2,13 +2,26 @@ from rest_framework import serializers @@ -2,13 +2,26 @@ from rest_framework import serializers
2 2
3 from subjects.serializers import TagSerializer 3 from subjects.serializers import TagSerializer
4 from topics.serializers import TopicSerializer 4 from topics.serializers import TopicSerializer
  5 +from pendencies.serializers import PendenciesSerializer
  6 +from students_group.serializers import StudentsGroupSerializer
5 7
6 from .models import FileLink 8 from .models import FileLink
7 9
8 class SimpleFileLinkSerializer(serializers.ModelSerializer): 10 class SimpleFileLinkSerializer(serializers.ModelSerializer):
9 topic = TopicSerializer() 11 topic = TopicSerializer()
10 tags = TagSerializer(many = True) 12 tags = TagSerializer(many = True)
  13 + pendencies_resource = PendenciesSerializer(many = True)
11 14
12 class Meta: 15 class Meta:
13 model = FileLink 16 model = FileLink
14 exclude = ('students', 'groups',) 17 exclude = ('students', 'groups',)
  18 +
  19 +class CompleteFileLinkSerializer(serializers.ModelSerializer):
  20 + topic = TopicSerializer()
  21 + tags = TagSerializer(many = True)
  22 + pendencies_resource = PendenciesSerializer(many = True)
  23 + groups = StudentsGroupSerializer(many = True)
  24 +
  25 + class Meta:
  26 + model = FileLink
  27 + fields = '__all__'
goals/serializers.py
@@ -2,6 +2,8 @@ from rest_framework import serializers @@ -2,6 +2,8 @@ from rest_framework import serializers
2 2
3 from subjects.serializers import TagSerializer 3 from subjects.serializers import TagSerializer
4 from topics.serializers import TopicSerializer 4 from topics.serializers import TopicSerializer
  5 +from pendencies.serializers import PendenciesSerializer
  6 +from students_group.serializers import StudentsGroupSerializer
5 7
6 from .models import Goals, GoalItem 8 from .models import Goals, GoalItem
7 9
@@ -14,7 +16,18 @@ class SimpleGoalSerializer(serializers.ModelSerializer): @@ -14,7 +16,18 @@ class SimpleGoalSerializer(serializers.ModelSerializer):
14 topic = TopicSerializer() 16 topic = TopicSerializer()
15 tags = TagSerializer(many = True) 17 tags = TagSerializer(many = True)
16 item_goal = GoalItemSerializer(many = True) 18 item_goal = GoalItemSerializer(many = True)
  19 + pendencies_resource = PendenciesSerializer(many = True)
17 20
18 class Meta: 21 class Meta:
19 model = Goals 22 model = Goals
20 exclude = ('students', 'groups',) 23 exclude = ('students', 'groups',)
  24 +
  25 +class CompleteGoalSerializer(serializers.ModelSerializer):
  26 + topic = TopicSerializer()
  27 + tags = TagSerializer(many = True)
  28 + pendencies_resource = PendenciesSerializer(many = True)
  29 + groups = StudentsGroupSerializer(many = True)
  30 +
  31 + class Meta:
  32 + model = Goals
  33 + fields = '__all__'
21 \ No newline at end of file 34 \ No newline at end of file
links/serializers.py
@@ -2,13 +2,26 @@ from rest_framework import serializers @@ -2,13 +2,26 @@ from rest_framework import serializers
2 2
3 from subjects.serializers import TagSerializer 3 from subjects.serializers import TagSerializer
4 from topics.serializers import TopicSerializer 4 from topics.serializers import TopicSerializer
  5 +from pendencies.serializers import PendenciesSerializer
  6 +from students_group.serializers import StudentsGroupSerializer
5 7
6 from .models import Link 8 from .models import Link
7 9
8 class SimpleLinkSerializer(serializers.ModelSerializer): 10 class SimpleLinkSerializer(serializers.ModelSerializer):
9 topic = TopicSerializer() 11 topic = TopicSerializer()
10 tags = TagSerializer(many = True) 12 tags = TagSerializer(many = True)
  13 + pendencies_resource = PendenciesSerializer(many = True)
11 14
12 class Meta: 15 class Meta:
13 model = Link 16 model = Link
14 exclude = ('students', 'groups',) 17 exclude = ('students', 'groups',)
  18 +
  19 +class CompleteLinkSerializer(serializers.ModelSerializer):
  20 + topic = TopicSerializer()
  21 + tags = TagSerializer(many = True)
  22 + pendencies_resource = PendenciesSerializer(many = True)
  23 + groups = StudentsGroupSerializer(many = True)
  24 +
  25 + class Meta:
  26 + model = Link
  27 + fields = '__all__'
15 \ No newline at end of file 28 \ No newline at end of file
pdf_file/serializers.py
@@ -2,13 +2,26 @@ from rest_framework import serializers @@ -2,13 +2,26 @@ from rest_framework import serializers
2 2
3 from subjects.serializers import TagSerializer 3 from subjects.serializers import TagSerializer
4 from topics.serializers import TopicSerializer 4 from topics.serializers import TopicSerializer
  5 +from pendencies.serializers import PendenciesSerializer
  6 +from students_group.serializers import StudentsGroupSerializer
5 7
6 from .models import PDFFile 8 from .models import PDFFile
7 9
8 class SimplePDFFileSerializer(serializers.ModelSerializer): 10 class SimplePDFFileSerializer(serializers.ModelSerializer):
9 topic = TopicSerializer() 11 topic = TopicSerializer()
10 tags = TagSerializer(many = True) 12 tags = TagSerializer(many = True)
  13 + pendencies_resource = PendenciesSerializer(many = True)
11 14
12 class Meta: 15 class Meta:
13 model = PDFFile 16 model = PDFFile
14 exclude = ('students', 'groups',) 17 exclude = ('students', 'groups',)
  18 +
  19 +class CompletePDFFileSerializer(serializers.ModelSerializer):
  20 + topic = TopicSerializer()
  21 + tags = TagSerializer(many = True)
  22 + pendencies_resource = PendenciesSerializer(many = True)
  23 + groups = StudentsGroupSerializer(many = True)
  24 +
  25 + class Meta:
  26 + model = PDFFile
  27 + fields = '__all__'
15 \ No newline at end of file 28 \ No newline at end of file
pendencies/serializers.py 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +from rest_framework import serializers
  2 +
  3 +from .models import Pendencies
  4 +
  5 +class PendenciesSerializer(serializers.ModelSerializer):
  6 + class Meta:
  7 + model = Pendencies
  8 + exclude = ('resource',)
students_group/serializers.py 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +from rest_framework import serializers
  2 +
  3 +from .models import StudentsGroup
  4 +
  5 +class StudentsGroupSerializer(serializers.ModelSerializer):
  6 + class Meta:
  7 + model = StudentsGroup
  8 + fields = '__all__'
subjects/templates/subjects/backup.html
@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 <h5>{% trans "Please select below the topics and resources which you want to backup:" %}</h5> 67 <h5>{% trans "Please select below the topics and resources which you want to backup:" %}</h5>
68 68
69 <div class="backup_container"> 69 <div class="backup_container">
70 - <form id="bkp_form" method="post" action="{% url 'subjects:do_backup' %}" enctype="multipart/form-data"> 70 + <form id="bkp_form" method="post" action="{% url 'subjects:do_backup' subject.slug %}" enctype="multipart/form-data">
71 {% csrf_token %} 71 {% csrf_token %}
72 72
73 {% for topic in topics %} 73 {% for topic in topics %}
@@ -90,6 +90,15 @@ @@ -90,6 +90,15 @@
90 </div> 90 </div>
91 {% endfor %} 91 {% endfor %}
92 92
  93 + {% if request.user.is_staff %}
  94 + <br clear="all" />
  95 + <div class="checkbox backup_item" style="margin-left: 0">
  96 + <label>
  97 + <input type="checkbox" name="participants" /> {% trans 'Include participants data.' %}
  98 + </label>
  99 + </div>
  100 + {% endif %}
  101 +
93 <div class="row text-center"> 102 <div class="row text-center">
94 <input type="submit" value="{% trans 'Backup' %}" class="btn btn-success btn-raised" /> 103 <input type="submit" value="{% trans 'Backup' %}" class="btn btn-success btn-raised" />
95 </div> 104 </div>
subjects/urls.py
@@ -10,7 +10,7 @@ urlpatterns = [ @@ -10,7 +10,7 @@ urlpatterns = [
10 url(r'^update/(?P<slug>[\w_-]+)/$', views.SubjectUpdateView.as_view(), name='update'), 10 url(r'^update/(?P<slug>[\w_-]+)/$', views.SubjectUpdateView.as_view(), name='update'),
11 url(r'^delete/(?P<slug>[\w_-]+)/$', views.SubjectDeleteView.as_view(), name='delete'), 11 url(r'^delete/(?P<slug>[\w_-]+)/$', views.SubjectDeleteView.as_view(), name='delete'),
12 url(r'^backup/(?P<slug>[\w_-]+)/$', views.Backup.as_view(), name='backup'), 12 url(r'^backup/(?P<slug>[\w_-]+)/$', views.Backup.as_view(), name='backup'),
13 - url(r'^do_backup/$', views.realize_backup, name='do_backup'), 13 + url(r'^do_backup/(?P<subject>[\w_-]+)/$', views.realize_backup, name='do_backup'),
14 url(r'^view/(?P<slug>[\w_-]+)/$', views.SubjectDetailView.as_view(), name='view'), 14 url(r'^view/(?P<slug>[\w_-]+)/$', views.SubjectDetailView.as_view(), name='view'),
15 url(r'^view/(?P<slug>[\w_-]+)/(?P<topic_slug>[\w_-]+)/$', views.SubjectDetailView.as_view(), name='topic_view'), 15 url(r'^view/(?P<slug>[\w_-]+)/(?P<topic_slug>[\w_-]+)/$', views.SubjectDetailView.as_view(), name='topic_view'),
16 url(r'^subscribe/(?P<slug>[\w_-]+)/$', views.SubjectSubscribeView.as_view(), name='subscribe'), 16 url(r'^subscribe/(?P<slug>[\w_-]+)/$', views.SubjectSubscribeView.as_view(), name='subscribe'),
subjects/views.py
@@ -41,17 +41,18 @@ from itertools import chain @@ -41,17 +41,18 @@ from itertools import chain
41 from django.core import serializers 41 from django.core import serializers
42 from rest_framework.renderers import JSONRenderer 42 from rest_framework.renderers import JSONRenderer
43 43
44 -from file_link.serializers import SimpleFileLinkSerializer 44 +from users.serializers import UserSerializer
  45 +from file_link.serializers import SimpleFileLinkSerializer, CompleteFileLinkSerializer
45 from file_link.models import FileLink 46 from file_link.models import FileLink
46 -from goals.serializers import SimpleGoalSerializer 47 +from goals.serializers import SimpleGoalSerializer, CompleteGoalSerializer
47 from goals.models import Goals 48 from goals.models import Goals
48 -from links.serializers import SimpleLinkSerializer 49 +from links.serializers import SimpleLinkSerializer, CompleteLinkSerializer
49 from links.models import Link 50 from links.models import Link
50 -from pdf_file.serializers import SimplePDFFileSerializer 51 +from pdf_file.serializers import SimplePDFFileSerializer, CompletePDFFileSerializer
51 from pdf_file.models import PDFFile 52 from pdf_file.models import PDFFile
52 -from youtube_video.serializers import SimpleYTVideoSerializer 53 +from youtube_video.serializers import SimpleYTVideoSerializer, CompleteYTVideoSerializer
53 from youtube_video.models import YTVideo 54 from youtube_video.models import YTVideo
54 -from webpage.serializers import SimpleWebpageSerializer 55 +from webpage.serializers import SimpleWebpageSerializer, CompleteWebpageSerializer
55 from webpage.models import Webpage 56 from webpage.models import Webpage
56 57
57 from amadeus.permissions import has_category_permissions, has_subject_permissions, has_subject_view_permissions, has_resource_permissions 58 from amadeus.permissions import has_category_permissions, has_subject_permissions, has_subject_view_permissions, has_resource_permissions
@@ -771,8 +772,9 @@ class Backup(LoginRequiredMixin, ListView): @@ -771,8 +772,9 @@ class Backup(LoginRequiredMixin, ListView):
771 return context 772 return context
772 773
773 @login_required 774 @login_required
774 -def realize_backup(request): 775 +def realize_backup(request, subject):
775 resources_ids = request.POST.getlist("resource[]") 776 resources_ids = request.POST.getlist("resource[]")
  777 + participants = request.POST.get('participants', False)
776 778
777 resource_files_subdir = "files" 779 resource_files_subdir = "files"
778 zip_filename = "backup.zip" 780 zip_filename = "backup.zip"
@@ -781,37 +783,59 @@ def realize_backup(request): @@ -781,37 +783,59 @@ def realize_backup(request):
781 783
782 zf = zipfile.ZipFile(s, "w", compression = zipfile.ZIP_DEFLATED) 784 zf = zipfile.ZipFile(s, "w", compression = zipfile.ZIP_DEFLATED)
783 785
784 - resources = Resource.objects.filter(id__in = resources_ids) 786 + webpages = Webpage.objects.filter(id__in = resources_ids)
  787 + ytvideos = YTVideo.objects.filter(id__in = resources_ids)
  788 + filelinks = FileLink.objects.filter(id__in = resources_ids)
  789 + links = Link.objects.filter(id__in = resources_ids)
  790 + pdffiles = PDFFile.objects.filter(id__in = resources_ids)
  791 + goals = Goals.objects.filter(id__in = resources_ids)
785 792
786 - for resource in resources:  
787 - if resource._my_subclass == "filelink":  
788 - fdir, fname = os.path.split(resource.filelink.file_content.path) 793 +
  794 + for filelink in filelinks:
  795 + if os.path.exists(filelink.file_content.path):
  796 + fdir, fname = os.path.split(filelink.file_content.path)
789 zip_path = os.path.join(resource_files_subdir, fname) 797 zip_path = os.path.join(resource_files_subdir, fname)
790 798
791 # Add file, at correct path 799 # Add file, at correct path
792 - zf.write(resource.filelink.file_content.path, zip_path)  
793 - elif resource._my_subclass == "pdffile":  
794 - fdir, fname = os.path.split(resource.pdffile.file.path) 800 + zf.write(filelink.file_content.path, zip_path)
  801 +
  802 + for pdffile in pdffiles:
  803 + if os.path.exists(pdffile.file.path):
  804 + fdir, fname = os.path.split(pdffile.file.path)
795 zip_path = os.path.join(resource_files_subdir, fname) 805 zip_path = os.path.join(resource_files_subdir, fname)
796 806
797 # Add file, at correct path 807 # Add file, at correct path
798 - zf.write(resource.pdffile.file.path, zip_path)  
799 -  
800 - webpages = Webpage.objects.filter(id__in = resources_ids)  
801 - ytvideos = YTVideo.objects.filter(id__in = resources_ids)  
802 - filelinks = FileLink.objects.filter(id__in = resources_ids)  
803 - links = Link.objects.filter(id__in = resources_ids)  
804 - pdffiles = PDFFile.objects.filter(id__in = resources_ids)  
805 - goals = Goals.objects.filter(id__in = resources_ids) 808 + zf.write(pdffile.file.path, zip_path)
806 809
807 file = open("backup.json", "w") 810 file = open("backup.json", "w")
808 811
809 - serializer_w = SimpleWebpageSerializer(webpages, many = True)  
810 - serializer_y = SimpleYTVideoSerializer(ytvideos, many = True)  
811 - serializer_f = SimpleFileLinkSerializer(filelinks, many = True)  
812 - serializer_l = SimpleLinkSerializer(links, many = True)  
813 - serializer_p = SimplePDFFileSerializer(pdffiles, many = True)  
814 - serializer_g = SimpleGoalSerializer(goals, many = True) 812 + if participants:
  813 + participants = User.objects.filter(subject_student__slug = subject)
  814 +
  815 + for user in participants:
  816 + if os.path.exists(user.image.path):
  817 + fdir, fname = os.path.split(user.image.path)
  818 + zip_path = os.path.join('users', fname)
  819 +
  820 + zf.write(user.image.path, zip_path)
  821 +
  822 + serializer_u = UserSerializer(participants, many = True)
  823 +
  824 + json.dump(serializer_u.data, file)
  825 +
  826 + serializer_w = CompleteWebpageSerializer(webpages, many = True)
  827 + serializer_y = CompleteYTVideoSerializer(ytvideos, many = True)
  828 + serializer_f = CompleteFileLinkSerializer(filelinks, many = True)
  829 + serializer_l = CompleteLinkSerializer(links, many = True)
  830 + serializer_p = CompletePDFFileSerializer(pdffiles, many = True)
  831 + serializer_g = CompleteGoalSerializer(goals, many = True)
  832 + else:
  833 + serializer_w = SimpleWebpageSerializer(webpages, many = True)
  834 + serializer_y = SimpleYTVideoSerializer(ytvideos, many = True)
  835 + serializer_f = SimpleFileLinkSerializer(filelinks, many = True)
  836 + serializer_l = SimpleLinkSerializer(links, many = True)
  837 + serializer_p = SimplePDFFileSerializer(pdffiles, many = True)
  838 + serializer_g = SimpleGoalSerializer(goals, many = True)
815 839
816 json.dump(serializer_w.data, file) 840 json.dump(serializer_w.data, file)
817 json.dump(serializer_y.data, file) 841 json.dump(serializer_y.data, file)
users/serializers.py
@@ -5,4 +5,4 @@ class UserSerializer(serializers.ModelSerializer): @@ -5,4 +5,4 @@ class UserSerializer(serializers.ModelSerializer):
5 class Meta: 5 class Meta:
6 model = User 6 model = User
7 fields = ('username','email','image','last_update','date_created','last_name','social_name', 7 fields = ('username','email','image','last_update','date_created','last_name','social_name',
8 - 'is_staff','is_active') 8 + 'is_staff','is_active','description')
webpage/serializers.py
@@ -2,13 +2,26 @@ from rest_framework import serializers @@ -2,13 +2,26 @@ from rest_framework import serializers
2 2
3 from subjects.serializers import TagSerializer 3 from subjects.serializers import TagSerializer
4 from topics.serializers import TopicSerializer 4 from topics.serializers import TopicSerializer
  5 +from pendencies.serializers import PendenciesSerializer
  6 +from students_group.serializers import StudentsGroupSerializer
5 7
6 from .models import Webpage 8 from .models import Webpage
7 9
8 class SimpleWebpageSerializer(serializers.ModelSerializer): 10 class SimpleWebpageSerializer(serializers.ModelSerializer):
9 topic = TopicSerializer() 11 topic = TopicSerializer()
10 tags = TagSerializer(many = True) 12 tags = TagSerializer(many = True)
  13 + pendencies_resource = PendenciesSerializer(many = True)
11 14
12 class Meta: 15 class Meta:
13 model = Webpage 16 model = Webpage
14 exclude = ('students', 'groups',) 17 exclude = ('students', 'groups',)
  18 +
  19 +class CompleteWebpageSerializer(serializers.ModelSerializer):
  20 + topic = TopicSerializer()
  21 + tags = TagSerializer(many = True)
  22 + pendencies_resource = PendenciesSerializer(many = True)
  23 + groups = StudentsGroupSerializer(many = True)
  24 +
  25 + class Meta:
  26 + model = Webpage
  27 + fields = '__all__'
15 \ No newline at end of file 28 \ No newline at end of file
youtube_video/serializers.py
@@ -2,13 +2,26 @@ from rest_framework import serializers @@ -2,13 +2,26 @@ from rest_framework import serializers
2 2
3 from subjects.serializers import TagSerializer 3 from subjects.serializers import TagSerializer
4 from topics.serializers import TopicSerializer 4 from topics.serializers import TopicSerializer
  5 +from pendencies.serializers import PendenciesSerializer
  6 +from students_group.serializers import StudentsGroupSerializer
5 7
6 from .models import YTVideo 8 from .models import YTVideo
7 9
8 class SimpleYTVideoSerializer(serializers.ModelSerializer): 10 class SimpleYTVideoSerializer(serializers.ModelSerializer):
9 topic = TopicSerializer() 11 topic = TopicSerializer()
10 tags = TagSerializer(many = True) 12 tags = TagSerializer(many = True)
  13 + pendencies_resource = PendenciesSerializer(many = True)
11 14
12 class Meta: 15 class Meta:
13 model = YTVideo 16 model = YTVideo
14 exclude = ('students', 'groups',) 17 exclude = ('students', 'groups',)
  18 +
  19 +class CompleteYTVideoSerializer(serializers.ModelSerializer):
  20 + topic = TopicSerializer()
  21 + tags = TagSerializer(many = True)
  22 + pendencies_resource = PendenciesSerializer(many = True)
  23 + groups = StudentsGroupSerializer(many = True)
  24 +
  25 + class Meta:
  26 + model = YTVideo
  27 + fields = '__all__'
15 \ No newline at end of file 28 \ No newline at end of file