wte.models
The models module contains the database models that are used to abstract the actual database.
models
wte.models.
Asset
The class:~wte.models.Asset represents any kind of file data. What role the Asset is used in depends on the type.
type
Instances of Asset have the following attributes:
id
data
filename
mimetype
order
parts
Part
menu
Generate the menu for this Asset. Will distinguish between assets, templates, and files.
DB_VERSION
The currently required database version.
The Part class represents the parts from which the teaching content is constructed. It supports the following types: module, tutorial, page, exercise, and task.
Instances of Part have the following attributes:
access_rights
assets
children
compiled_content
content
display_mode
label
parent_id
parent
progress
UserPartProgress
status
summary
tasks
TimedTask
templates
title
users
User
allow
Checks whether the given user is allowed to perform the given action. Supports the following actions: view, edit, delete, and users.
user
action
True if the user may perform the action, False otherwise
True
False
bool
available_children
Returns the list of child Part for which the status attribute is set to “available”.
list()
has_role
Checks if the given user has the given role for this Part. If a list is specified as the role, then the user must have at least one of the specified roles.
role
list
unicode
True if the User has the given role, False otherwise
Generates the menu for the Part.
next
Returns the next Part in the list of siblings.
prev
Returns the previous Part in the list of siblings.
root
Gets the root Part for the current Part. If the Part has no parent, then returns itself.
Generates the text summary for this Part. The text summary is generated by finding the first tag in the compiled_content and then returning that.
Quiz
The Quiz represents a Quiz in the database.
Instances of QuizAnswer have the following attributes:
QuizAnswer
answers
part_id
name
questions
The class:~wte.models.QuizAnswer represents an answer to a QuizQuestion in a Quiz.
QuizQuestion
attempts
final_answer
final_correct
initial_answer
initial_correct
question
quiz_id
quiz
user_id
The class:~wte.models.TimedTask represents a task that is to be run at a specific time in the future.
Instances of TimedTask have the following attributes:
timestamp
_options
options
delta
Get the timedelta between the TimedTask‘s timestamp and datetime.now().
timedelta
datetime.now()
Generate the menu for this TimedTask.
Get / Set the options for this TimedTask.
When setting options, the new options must be of type dict.
dict
When getting options, the options will be returned as a dict.
The UserPartProgress represents the progress a User has made through a Part.
Instances of UserPartProgress have the following attributes:
current_id
current
files
part
visited
MutableDict
JSONUnicodeText
Checks whether the given user is allowed to perform the given action. Supports the following action: view.
UserPartRole
The UserPartRole links users to Part that have a type “module”. They represent the role the User plays for that Part.
Instances of UserPartRole have the following attributes:
parts_assets
sqlalchemy.Table to link Part and Asset.
sqlalchemy.Table
progress_assets
wte.helpers.frontend
wte.scripts