quizApp.views package¶
Submodules¶
quizApp.views.activities module¶
Views for CRUD of activities.
In order to be as general as possible, each of the activity-specific views tests the kind of activity it is loading and then defers to a more specific function (for example, questions are read by read_question rather than read_activity itself).
-
class
quizApp.views.activities.ActivityCollectionView[source]¶ Bases:
quizApp.views.common.ObjectCollectionViewView for the activity collection.
-
decorators= [<function wrapper>]¶
-
methods= ['GET', 'POST']¶
-
resolve_kwargs¶ alias of
dict
-
template= 'activities/read_activities.html'¶
-
-
class
quizApp.views.activities.ActivityView[source]¶ Bases:
quizApp.views.common.ObjectViewViews for a particular Activity.
-
methods= ['GET', 'PUT', 'DELETE']¶
-
object_key= 'activity'¶
-
-
class
quizApp.views.activities.ChoiceCollectionView[source]¶ Bases:
quizApp.views.common.ObjectCollectionViewHandle a collection of choices.
-
decorators= [<function wrapper>]¶
-
get_members= None¶
-
methods= ['POST']¶
-
template= None¶
-
-
class
quizApp.views.activities.ChoiceView[source]¶ Bases:
quizApp.views.common.ObjectViewView for handling a singular Choice object.
-
methods= ['PUT', 'DELETE']¶
-
object_key= 'choice'¶
-
-
quizApp.views.activities.create_question_dataset(*args, **kwargs)[source]¶ Associate this question with a dataset.
The request should contain the ID of the dataset to be associated.
-
quizApp.views.activities.delete_question_dataset(*args, **kwargs)[source]¶ Disassociate this question from a dataset.
-
quizApp.views.activities.render_activity(activity, *args, **kwargs)[source]¶ Given an activity, render the template that displays this activity and return it.
This function is the central place where activities are rendered.
Extra args/kwargs will be passed on to the specific rendering function for the type of activity.
-
quizApp.views.activities.render_question(question, disabled=False, assignment=None, render_explanation=True)[source]¶ Display a given question as it would appear to a participant.
Parameters: - question (Question) – The question to render
- disabled (bool) – if True, disable the form controls
- assignment (Assignment) – if given, use the assignment’s result and comment to populate fields prior to rendering
- render_explanation (bool) – If True, render the explanation for this question
-
quizApp.views.activities.render_scorecard(scorecard, disabled=False, assignment_set=None, assignment=None, this_index=0)[source]¶ Render a scorecard. This is the central point of rendering for scorecards.
-
quizApp.views.activities.settings_activity(*args, **kwargs)[source]¶ Display settings for a particular activity.
-
quizApp.views.activities.settings_mc_question(question, template_kwargs)[source]¶ Display settings for the given question.
quizApp.views.core module¶
This blueprint takes care of rendering static pages outside of the other blueprints.
-
quizApp.views.core.auto_register()[source]¶ Convenience endpoint for using QuizApp embedded in another site.
When a logged in user accesses this endpoint, they will be redirected to the specified experiment.
When a user that is not logged in access this endpoint, an account will be created, they will be logged in, then redirected to the specified experiment.
-
quizApp.views.core.getting_started(*args, **kwargs)[source]¶ Show some instructions for getting started with quizApp.
quizApp.views.datasets module¶
Views for CRUD datasets.
-
class
quizApp.views.datasets.DatasetCollectionView[source]¶ Bases:
quizApp.views.common.ObjectCollectionViewView for managing a collection of Datasets.
-
decorators= [<function wrapper>]¶
-
methods= ['GET', 'POST']¶
-
resolve_kwargs¶ alias of
dict
-
template= 'datasets/read_datasets.html'¶
-
-
class
quizApp.views.datasets.DatasetView[source]¶ Bases:
quizApp.views.common.ObjectViewView for handling a particular dataset.
-
methods= ['PUT', 'DELETE']¶
-
object_key= 'dataset'¶
-
-
class
quizApp.views.datasets.MediaItemCollectionView[source]¶ Bases:
quizApp.views.common.ObjectCollectionViewManage a collection of MediaItems.
-
decorators= [<function wrapper>]¶
-
get_members= None¶
-
methods= ['POST']¶
-
template= None¶
-
-
class
quizApp.views.datasets.MediaItemView[source]¶ Bases:
quizApp.views.common.ObjectViewView for handling a particular media item
-
methods= ['DELETE', 'PUT', 'GET']¶
-
object_key= 'media_item'¶
-
template= 'datasets/read_media_item.html'¶
-
quizApp.views.experiments module¶
Views that handle CRUD for experiments and rendering questions for participants.
-
class
quizApp.views.experiments.ExperimentCollectionView[source]¶ Bases:
quizApp.views.common.ObjectCollectionViewView for a collection of Experiments.
-
decorators= [<function wrapper>]¶
-
methods= ['GET', 'POST']¶
-
template= 'experiments/read_experiments.html'¶
-
-
class
quizApp.views.experiments.ExperimentView[source]¶ Bases:
quizApp.views.common.ObjectViewView for a particular experiment.
-
decorators= [<function login_required>]¶
-
methods= ['GET', 'PUT', 'DELETE']¶
-
object_key= 'experiment'¶
-
template= 'experiments/read_experiment.html'¶
-
-
quizApp.views.experiments.confirm_done_assignment_set(*args, **kwargs)[source]¶ Show the user a page before finalizing their quiz answers.
-
quizApp.views.experiments.done_assignment_set(*args, **kwargs)[source]¶ Show the user a screen indicating that they are finished.
-
quizApp.views.experiments.export_results_experiment(*args, **kwargs)[source]¶ Get a spreadsheet breaking down how participants did in this experiment.
-
quizApp.views.experiments.finalize_assignment_set(*args, **kwargs)[source]¶ Finalize the user’s answers for this experiment. They will no longer be able to edit them, but may view them.
-
quizApp.views.experiments.get_activity_column_index(activity, activity_column_mapping, activity_counter, headers)[source]¶ Find the column index for this occurrence of the given activity. This will update headers, counter, and mapping if necessary.
-
quizApp.views.experiments.get_next_assignment_url(assignment_set, current_index)[source]¶ Given an experiment, a assignment_set, and the current index, find the url of the next assignment in the sequence.
-
quizApp.views.experiments.get_question_stats(assignment, question_stats)[source]¶ Given an assignment of a question and a stats array, return statistics about this question in the array.
-
quizApp.views.experiments.get_results_workbook(experiment)[source]¶ Analyze the assignment sets in the experiment and return an excel workbook.
-
quizApp.views.experiments.populate_row_segment(sheet, row_index, initial_col, row)[source]¶ Populate the segment of row #
row_indexinsheetthat starts atinitial_coland contains the items inrow.
-
quizApp.views.experiments.read_assignment(*args, **kwargs)[source]¶ Given an assignment ID, retrieve it from the database and display it to the user.
-
quizApp.views.experiments.read_mc_question(_, assignment)[source]¶ Read a multiple choice question, making sure to save the choice order.
-
quizApp.views.experiments.read_question(experiment, assignment)[source]¶ Common code for reading questions.
-
quizApp.views.experiments.read_scorecard(experiment, assignment)[source]¶ Read an assignment that is a scorecard.
-
quizApp.views.experiments.settings_experiment(*args, **kwargs)[source]¶ Give information on an experiment and its activities.
-
quizApp.views.experiments.update_assignment(experiment_id, assignment_set_id, assignment_id)[source]¶ Record a user’s answer to this assignment
quizApp.views.helpers module¶
Various functions that are useful in multiple views.
-
quizApp.views.helpers.get_first_assignment(experiment)[source]¶ Get the first assignment for this user in this experiment.
Note that this is not necessarily the same as the first assignment in an assignment set. This function will first call
get_or_create_assignment_setin order to retrieve an assignment set. If there is no assignment set or it is empty, this function returns none.If the set is complete, this function returns the first assignment in the set.
-
quizApp.views.helpers.get_or_create_assignment_set(experiment)[source]¶ Attempt to retrieve the AssignmentSet record for the current user in the given Experiment.
If no such record exists, grab a random AssignmentSet record in the experiment AssignmentSet pool, copy it to be the current user’s AssignmentSet record, and return that.