Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[run]
branch = True
data_file = .coverage
source=openedx_learning
source =
openedx_learning
openedx_tagging
omit =
test_settings
*migrations*
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ include LICENSE.txt
include README.rst
include requirements/base.in
recursive-include openedx_learning *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py
recursive-include openedx_tagging *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ docs: ## generate Sphinx HTML documentation, including API docs
$(BROWSER)docs/_build/html/index.html

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --rebuild --upgrade $(PIP_COMPILE_OPTS)
PIP_COMPILE = pip-compile --rebuild $(PIP_COMPILE_OPTS)

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
compile-requirements: export CUSTOM_COMPILE_COMMAND=make upgrade
compile-requirements: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
Expand All @@ -47,6 +47,9 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt

upgrade: ## update the pip requirements files to use the latest releases satisfying our constraints
make compile-requirements PIP_COMPILE_OPTS="--upgrade"

quality: ## check coding style with pycodestyle and pylint
tox -e quality

Expand Down Expand Up @@ -77,12 +80,16 @@ extract_translations: ## extract strings to be translated, outputting .mo files
rm -rf docs/_build
cd openedx_learning && ../manage.py makemessages -l en -v1 -d django
cd openedx_learning && ../manage.py makemessages -l en -v1 -d djangojs
cd openedx_tagging && ../manage.py makemessages -l en -v1 -d django
cd openedx_tagging && ../manage.py makemessages -l en -v1 -d djangojs

compile_translations: ## compile translation files, outputting .po files for each supported language
cd openedx_learning && ../manage.py compilemessages
cd openedx_tagging && ../manage.py compilemessages

detect_changed_source_translations:
cd openedx_learning && i18n_tool changed
cd openedx_tagging && i18n_tool changed

pull_translations: ## pull translations from Transifex
tx pull -a -f -t --mode reviewed
Expand All @@ -92,6 +99,7 @@ push_translations: ## push source translation files (.po) from Transifex

dummy_translations: ## generate dummy translation (.po) files
cd openedx_learning && i18n_tool dummy
cd openedx_tagging && i18n_tool dummy

build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files

Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Parts

* ``openedx_learning.lib`` is for shared utilities, and may include things like custom field types, plugin registration code, etc.
* ``openedx_learning.core`` contains our Core Django apps, where foundational data structures and APIs will live.
* ``openedx_tagging.core`` contains the core Tagging app, which provides data structures and apis for tagging Open edX objects.

App Dependencies
~~~~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions docs/decisions/0009-tagging-administrators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ But because permissions #2 + #3 require access to the edx-platform CMS model `Co

Per `OEP-9`_, ``openedx_tagging`` will allow applications to use the standard Django API to query permissions, for example: ``user.has_perm('openedx_tagging.edit_taxonomy', taxonomy)``, and the appropriate permissions will be applied in that application's context.

These rules will be enforced in the tagging `views`_, not the API or models, so that external code using this library need not have a logged-in user in order to call the API. So please use with care.

Rejected Alternatives
---------------------

Expand All @@ -37,3 +39,4 @@ This is a standard way to grant access in Django apps, but it is not used in Ope
.. _get_organizations: https://github.com/openedx/edx-platform/blob/4dc35c73ffa6d6a1dcb6e9ea1baa5bed40721125/cms/djangoapps/contentstore/views/course.py#L1958
.. _CourseCreator: https://github.com/openedx/edx-platform/blob/4dc35c73ffa6d6a1dcb6e9ea1baa5bed40721125/cms/djangoapps/course_creators/models.py#L27
.. _OEP-9: https://open-edx-proposals.readthedocs.io/en/latest/best-practices/oep-0009-bp-permissions.html
.. _views: https://github.com/dfunckt/django-rules#permissions-in-views
7 changes: 1 addition & 6 deletions openedx_learning/lib/collations.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ def __init__(self, *args, db_collations=None, db_collation=None, **kwargs):
it for Django 3.2 compatibility (see the ``db_collation`` method
docstring for details).
"""
if db_collation is not None:
raise ValueError(
f"Cannot use db_collation with {self.__class__.__name__}. "
+ "Please use a db_collations dict instead."
)

super().__init__(*args, **kwargs)
self.db_collations = db_collations or {}
Expand Down Expand Up @@ -106,7 +101,7 @@ def db_parameters(self, connection):
def deconstruct(self):
"""
How to serialize our Field for the migration file.

For our mixin fields, this is just doing what the field's superclass
would do and then tacking on our custom ``db_collations`` dict data.
"""
Expand Down
6 changes: 4 additions & 2 deletions openedx_tagging/core/tagging/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
""" Tagging app admin """
from django.contrib import admin

from .models import TagContent
from .models import ObjectTag, Tag, Taxonomy

admin.site.register(TagContent)
admin.site.register(Taxonomy)
admin.site.register(Tag)
admin.site.register(ObjectTag)
Loading