Repository navigation
Tagging: More powerful, flexible implementation of get_filtered_tags() [FC-0036] #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bf1361d
feat: new implementation of get_filtered_tags
bradenmacdonald 61499c1
feat: update and simplify tests in test_template.py
bradenmacdonald c46edaa
chore: get API tests passing
bradenmacdonald 3eafff7
chore: get import/export tests passing
bradenmacdonald 4f2e3f7
feat: refactor views to use new get_filtered_tags()
bradenmacdonald e7bb5ba
chore: update isort command to remove deprecated parameter
bradenmacdonald 868f3b8
docs: document how to run the tests on MySQL locally
bradenmacdonald e2421da
fix: fix sorting tags on MySQL
bradenmacdonald 941f473
docs: minor clarifications
bradenmacdonald b567a3f
fix: make tree sorting case insensitive
bradenmacdonald 3f2bab6
feat: disable include_counts by default
bradenmacdonald 9b824e2
fix: mark TagData["usage_count"] using typing.NotRequired
bradenmacdonald 68f6f19
fix: warn if excluded_values will be ignored
bradenmacdonald 72e782b
chore: update with latest master
bradenmacdonald 9e94ee4
chore: updates for compatibility with master changes
bradenmacdonald 7348785
chore: version bump
bradenmacdonald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| """ | ||
| Data models used by openedx-tagging | ||
| """ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING, Any, TypedDict | ||
|
|
||
| from django.db.models import QuerySet | ||
| from typing_extensions import TypeAlias | ||
|
|
||
|
|
||
| class TagData(TypedDict): | ||
| """ | ||
| Data about a single tag. Many of the tagging API methods return Django | ||
| QuerySets that resolve to these dictionaries. | ||
|
|
||
| Even though the data will be in this same format, it will not necessarily | ||
| be an instance of this class but rather a plain dictionary. This is more a | ||
| type than a class. | ||
| """ | ||
| value: str | ||
| external_id: str | None | ||
| child_count: int | ||
| depth: int | ||
| parent_value: str | None | ||
| # Note: usage_count may not actually be present but there's no way to indicate that w/ python types at the moment | ||
| usage_count: int | ||
| # Internal database ID, if any. Generally should not be used; prefer 'value' which is unique within each taxonomy. | ||
| _id: int | None | ||
|
|
||
|
|
||
| if TYPE_CHECKING: | ||
| from django_stubs_ext import ValuesQuerySet | ||
| TagDataQuerySet: TypeAlias = ValuesQuerySet[Any, TagData] | ||
| # The following works better for pyright (provides proper VS Code autocompletions), | ||
| # but I can't find any way to specify different types for pyright vs mypy :/ | ||
| # TagDataQuerySet: TypeAlias = QuerySet[TagData] | ||
| else: | ||
| TagDataQuerySet = QuerySet[TagData] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.