openedx.core.djangoapps.xmodule_django package#
Submodules#
openedx.core.djangoapps.xmodule_django.models module#
Useful django models for implementing XBlock infrastructure in django.
- class openedx.core.djangoapps.xmodule_django.models.BlockTypeKeyField(*args, **kwargs)#
Bases:
BlockTypeKeyFieldA django Field that stores a BlockTypeKey object as a string.
- class openedx.core.djangoapps.xmodule_django.models.CourseKeyField(*args, **kwargs)#
Bases:
CourseKeyFieldA django Field that stores a CourseKey object as a string.
- class openedx.core.djangoapps.xmodule_django.models.NoneToEmptyManager(*args, **kwargs)#
Bases:
ManagerA
django.db.models.Managerthat has aNoneToEmptyQuerySetas its QuerySet, initialized with a set of specified field_names.- get_queryset()#
Returns the result of NoneToEmptyQuerySet instead of a regular QuerySet.
- class openedx.core.djangoapps.xmodule_django.models.NoneToEmptyQuerySet(model=None, query=None, using=None, hints=None)#
Bases:
QuerySetA
django.db.query.QuerySetthat replaces None values passed to filter and exclude with the corresponding Empty value for all fields with an Empty attribute.This is to work around Django automatically converting exact queries for None into isnull queries before the field has a chance to convert them to queries for it’s own empty value.
- class openedx.core.djangoapps.xmodule_django.models.OpaqueKeyField(*args, **kwargs)#
Bases:
OpaqueKeyFieldA django field for storing OpaqueKeys.
The baseclass will return the value from the database as a string, rather than an instance of an OpaqueKey, leaving the application to determine which key subtype to parse the string as.
Subclasses must specify a KEY_CLASS attribute, in which case the field will use
from_string()to parse the key string, and will return an instance of KEY_CLASS.
- class openedx.core.djangoapps.xmodule_django.models.UsageKeyField(*args, **kwargs)#
Bases:
UsageKeyFieldA django Field that stores a UsageKey object as a string.
- class openedx.core.djangoapps.xmodule_django.models.UsageKeyWithRunField(*args, **kwargs)#
Bases:
UsageKeyFieldSubclass of UsageKeyField that automatically fills in missing run values, for old Mongo courses.
- to_python(value)#
Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can’t be converted. Return the converted value. Subclasses should override this.