26 Commits

Author SHA1 Message Date
Jesper Hodge
a6c57811cd feat add xblock api endpoint (#32282)
* feat: add xblock endpoint for updating an xblock

fix: remove debugger

feat: make function call more generic

refactor: just use request.json for request data as before

refactor: extract method

fix: revert wrong method change

fix: refactor correct method

feat: use handle_xblock method so that we can do more than update xblocks

fix: usage_key_string defaults to None

add all CRUD operations

fix usage key parameter

refactor: create /views folder

refactor: move xblock view functions to xblock_services

fix: tests

fix: tests

refactor: move xblock API endpoint to contentstore

* docs: add explanatory comment to new xblock_service

* feat: add feature flag for enabling content editing api

* feat: raise 404 if studio content api is disabled

* tests: test xblock endpoint

* test: make all post tests work

* test: check that xblock_handler receives correct args

* refactor: create util mixin for course factories with staff

* refactor: extract course staff authorization tests

* refactor: extract tests to api view testcase class

* test: add get tests

* test: fix tests

* test: fix tests

* test: fix tests

* test: add all crud tests

* fix: refactor to fix tests

* fix: merge conflict

* fix: merge conflict

* fix: tests after merge

* fix: json request decorator

* fix: lint

* fix: lint

* fix: lint

* fix: lint

* fix: new test files

* fix: lint

* fix: lint and apply PR suggestions

* fix: lint

* fix: lint

* fix: lint

* fix: lint

* fix: lint

* fix: lint
2023-06-15 14:17:49 -04:00
M. Zulqarnain
42eacaf8de refactor: pyupgrade in common/util + xblock_django (#26724) 2021-03-09 16:49:51 +05:00
usamasadiq
240a8c2e1a Fix pep8 errors 2021-02-02 18:36:39 +05:00
Jawayria
9059dee397 Applied pylint-amnesty to util 2021-02-02 18:36:39 +05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Dave St.Germain
9d8db8e4ca Convert to utf-8 before JSON decoding 2019-08-19 15:10:56 -04:00
Evans Dianga
391b91b99a Modernize common/djangoapps/util- INCR-203 (#20437) 2019-05-07 09:53:17 -04:00
Andy Armstrong
93235d118d Reorder imports using isort (except lms and cms) 2017-05-30 16:04:54 -04:00
Eric Fischer
a9a3fabfe8 Bulk Email Multiselect (#12301)
TNL-4356

Allows multiple bulk email targets to be specified at once.

-The previous "All" option has been split into "Staff" and "Learners"
-The backend changes made here lay the groundwork for cohort emailing
-The data migration, 0005, is somewhat large and requires deploy attention
-Tests have been updated
-Numerous safe-commit-linter fixes are included
2016-05-26 14:22:04 -04:00
Usman Khalid
6cb62f2697 Rebase upgrade Django to v1.8.5
Please note that this is a squshed commit and the work of:
Symbolist, macdiesel, nedbat, doctoryes, muzaffaryousaf and muhammad-ammar
2015-11-10 15:00:19 -05:00
Nimisha Asthagiri
0687a62a8f Add back end for Studio video upload feature
This feature allows upload of video assets to S3. This requires that the
VIDEO_UPLOAD_PIPELINE setting be properly configured and that each
course be configured with a token issued by the media team for their
processing purposes (e.g. linking the video with a YouTube channel).

Co-authored-by: Greg Price <gprice@edx.org>
2014-12-15 13:09:59 -05:00
Se Won Jang
11d260910f Implemented Validation for Course Advanced Setting
This commit adds validation for course advanced settings. Currently when course
administrators make invalid changes in the Settings/Advanced Settings tab,
they're not notified through a new modal window of the list of invalid settings
changes.

* Extending CourseMetadata
    - Previously, we only had update_from_json method in CourseMetadata.py,
      and it was only validating one field every POST request.
    - Now we have validate_and_update_from_json method that encapsulates the
      functionality of update_from_json into a validation call
    - To avoid discrepancy of validation standards between modules, validation
      uses the from_json method implemented to each field in xblock.

* Different Response in advanced settings ajax requests
    - After receiving a POST ajax request, course.py calls
      validate_and_update_from_json, and sends a json object of either:
        1) valid course metadata model
        2) error objects

* Error Messages shown in validation-error-modal
    - error objects passed through ajax are shown in a separate modal.
2014-08-26 11:24:38 -07:00
Don Mitchell
7f91ce40ae Restful api for course advanced settings
STUD-948
2013-11-26 10:17:52 -05:00
cahrens
16766a5ee9 Change delete_item to RESTful URL.
Part of STUD-847.
2013-11-06 13:49:24 -05:00
Don Mitchell
45453fae61 Change expect_json to put parsed json in new attr 2013-10-29 16:13:58 -04:00
David Baumgold
ef81556cc5 Use JsonResponse when it makes sense 2013-07-09 19:16:08 -04:00
David Baumgold
27e895393c Added generic JsonResponse class
Based on http://djangosnippets.org/snippets/154/
2013-07-09 19:16:07 -04:00
Don Mitchell
c7046df0f2 Make request.POST be only json content when using expect_json 2013-06-28 14:19:10 -04:00
Calen Pennington
cfae1cdf62 Pep8 autofixes 2013-02-06 11:13:50 -05:00
Chris Dodge
e70db062b2 Merge branch 'feature/cale/cms-master' into feature/cale/cms-master-merge
Conflicts:
	requirements.txt
2013-01-03 10:46:24 -05:00
Chris Dodge
7229a9cdaf perform a new merge from master, resolve conflicts 2013-01-03 10:43:03 -05:00
Chris Dodge
79e48dde97 move the underscore tempaltes to /static/client-templates and update the references 2012-12-10 10:01:08 -05:00
Chris Dodge
0a7dfca0e4 Fix JSON postback error where the content-type header line can contain more info than just the application/json descriptor. Now we just to a compare on the start of the header value. 2012-09-21 14:25:48 -04:00
Bridger Maxwell
14a35b9605 Upgrading to django 1.4. 2012-08-08 11:57:15 -04:00
Calen Pennington
1d1a9173a4 Cleaning up pep8 violations 2012-07-23 14:44:40 -04:00
Prem Sichanugrist
0f60459709 Add @expect_json to help with parsing JSON request 2012-07-05 09:38:51 -04:00