Quiz package

Submodules

Quiz.admin module

Quiz.apps module

class Quiz.apps.QuizConfig(app_name, app_module)

Bases: django.apps.config.AppConfig

name = 'Quiz'

Quiz.helperClasses module

class Quiz.helperClasses.statsByQuery(query)

Bases: object

getTotal()

Quiz.models module

class Quiz.models.ChildComment(*args, **kwargs)

Bases: django.db.models.base.Model

The ChildComment class defines the main storage point for the child comments as TopComments. Each TopComment has five fields:

  • parentid: Stores the topComment ID associated with the child comment.

  • id: Stores the unique idenfier of a child comment.

  • comment: Stores the text comment of the child comment.

  • user: Stores the username who created the child comment.

  • date: Stores the creation data of the child comment.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

comment

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)
get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
parentid

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

parentid_id
user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class Quiz.models.QuestionLearningOutCome(*args, **kwargs)

Bases: django.db.models.base.Model

Model for QuestionLearningOutcome table in db

  • qid: question id tag, foreign key

  • learningOutcome: learning outcome associated with question

  • topic: topic assossciated with question

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

learningoutcome

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
qid

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

qid_id
class Quiz.models.QuestionRatings(*args, **kwargs)

Bases: django.db.models.base.Model

The QuestionRating class defines the main storage point for ratings for a question. Each QuestionRating has three fields:

  • qid: Stores the question ID associated with the rating.

  • username: Stores the username who created the rating.

  • rating: Stores an integer indicating the rating (0 - 5).

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
qid

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

qid_id
rating

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

username

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

username_id
class Quiz.models.QuestionTags(*args, **kwargs)

Bases: django.db.models.base.Model

Model for QuestionTags table in db

  • qid: question id tag, foreign key

  • tag: tag, foreign key

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
qid

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

qid_id
tag

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class Quiz.models.Questions(*args, **kwargs)

Bases: django.db.models.base.Model

The Question class defines the main storage point for questions. Each question has twelve fields:

  • _id: Stores the unique identifier of a question.

  • prompt: Stores the prompt of the question.

  • shuffleOption: Used to control if the answers choices are shuffled.

  • learningOutCome: Stores a list of learning outcome associated with the question.

  • typeName: Used to control the amount of answer choices are allowed to be selected.

  • topic: Stores the topic associated with the question.

  • username: Stores the username who created the question.

  • choices: Stores the choices for a question.

  • choiceanswers: Stores the correctness of the choices.

  • feedback: Stores the feedback for each choice.

  • draft: Used to control if the question will appear in quizzes.

  • hidden: Used to control if the question is displayed to users.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

choiceanswers

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

choices

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

draft

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feedback

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hidden

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

learningoutcome

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
prompt

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

questionlearningoutcome_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

questionratings_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

questiontags_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

shuffleoption

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

topcomment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

topic

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

topic_id
typename

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

username

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

username_id
class Quiz.models.ReviewQuiz(*args, **kwargs)

Bases: django.db.models.base.Model

The Review Quiz class defines the main storage point for completed quizzes that are generated by Students

Each review quiz has eight fields:

  • _id: Stores the unique idenfier of a completed quiz.

  • questions: Stores an array of question IDs.

  • answers: Stores an array of answers selected by the Student.

  • correct: Stores an integer of the amount of question the Student got correct in the quiz.

  • total: Stores an integer of the amount of questions in the quiz.

  • username: Stores the username who took the quiz.

  • topic: Stores the topic associated with the quiz.

  • correctness: Stores an array of correctness of each question in the quiz.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

answers

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

correct

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

correctness

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
questions

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

topic

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

topic_id
total

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

username

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

username_id
class Quiz.models.Tags(*args, **kwargs)

Bases: django.db.models.base.Model

The Tag class defines the main storage point for tags. Tags are used to tag topics.

Each tag has one field:

  • tag: Stores the text of a tag.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

objects = <django.db.models.manager.Manager object>
tag

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class Quiz.models.TopComment(*args, **kwargs)

Bases: django.db.models.base.Model

The TopComment class defines the main storage point for the top comments for questions. Each TopComment has five fields:

  • parentid: Stores the question ID associated with a comment.

  • commentid: Stores the unique idenfier of a comment.

  • comment: Stores the text comment of the comment.

  • user: Stores the username who created the comment.

  • date: Stores the creation data of the comment.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

childcomment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

comment

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

commentid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)
get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)
objects = <django.db.models.manager.Manager object>
parentid

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

parentid_id
user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class Quiz.models.TopicLearningOutcome(id, topic, learningoutcome)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

learningoutcome

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
topic

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

topic_id
class Quiz.models.Topics(*args, **kwargs)

Bases: django.db.models.base.Model

The Topic class defines the main storage point for topics.

Each topic has four fields:

  • name: Stores the unique name of a topic.

  • creator_id: Stores the user who created the topic.

  • learningOutcomes: Stores an array of learning outcomes in a topic.

  • tags: Stores an array of tags associated to the topic.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

creator_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

creator_id_id
hidden

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

learningoutcomes

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
questions_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

reviewquiz_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

tags

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

topiclearningoutcome_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class Quiz.models.UserManager

Bases: django.contrib.auth.base_user.BaseUserManager

create_superuser(username, email, password)
create_user(username, email, password=None, student=False, professor=False)
class Quiz.models.Users(password, last_login, email, username, active, student, salt, contributor, professor, admin, created_at)

Bases: django.contrib.auth.base_user.AbstractBaseUser

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

REQUIRED_FIELDS = ['username']
USERNAME_FIELD = 'email'
active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

admin

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

childcomment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contributor

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

email

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_full_name()
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
has_module_perms(app_label)
has_perm(perm, obj=None)
is_active()

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

property is_admin
property is_professor
property is_student
logentry_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <Quiz.models.UserManager object>
professor

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

questionratings_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

questions_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

reviewquiz_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

salt

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

student

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property token
topcomment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

topics_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

username

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Quiz.serializers module

class Quiz.serializers.ChildCommentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['parentid', 'id', 'comment', 'user', 'date']
model

alias of Quiz.models.ChildComment

class Quiz.serializers.QuestionCommentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['_id', 'username']
lookup_field = '_id'
model

alias of Quiz.models.Questions

class Quiz.serializers.QuestionLearningOutComeSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['qid', 'learningoutcome', 'topic']
model

alias of Quiz.models.QuestionLearningOutCome

class Quiz.serializers.QuestionRatingsSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['qid', 'username', 'rating']
model

alias of Quiz.models.QuestionRatings

class Quiz.serializers.QuestionSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['_id', 'prompt', 'shuffleoption', 'choices', 'choiceanswers', 'typename', 'topic', 'username', 'learningoutcome', 'feedback', 'draft', 'hidden']
lookup_field = '_id'
model

alias of Quiz.models.Questions

class Quiz.serializers.ReviewQuizSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['_id', 'questions', 'answers', 'correct', 'total', 'username', 'topic', 'correctness']
model

alias of Quiz.models.ReviewQuiz

class Quiz.serializers.TagsSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['tag']
model

alias of Quiz.models.Tags

class Quiz.serializers.TopCommentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['parentid', 'commentid', 'comment', 'user', 'date']
lookup_field = 'commentid'
model

alias of Quiz.models.TopComment

class Quiz.serializers.TopicLearningOutcomeSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['topic', 'learningoutcome']
model

alias of Quiz.models.TopicLearningOutcome

class Quiz.serializers.TopicsSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['name', 'creator_id', 'tags', 'learningoutcomes']
model

alias of Quiz.models.Topics

class Quiz.serializers.UsersSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

class Meta

Bases: object

fields = ['email', 'username', 'password', 'created_at', 'contributor', 'student', 'professor', 'admin']
lookup_field = 'username'
model

alias of Quiz.models.Users

Quiz.test_view module

class Quiz.test_view.CreateNewQuestionTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Creating a Question

setUp()

Hook method for setting up the test fixture before exercising it.

test_create_invalid_question_1()
test_create_invalid_question_10()
test_create_invalid_question_2()
test_create_invalid_question_3()
test_create_invalid_question_4()
test_create_invalid_question_5()
test_create_invalid_question_6()
test_create_invalid_question_7()
test_create_invalid_question_8()
test_create_invalid_question_9()
test_create_valid_question()
class Quiz.test_view.CreateNewTopicTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Inserting a new Topic

setUp()

Hook method for setting up the test fixture before exercising it.

test_create_invalid_topic_1()
test_create_invalid_topic_2()
test_create_invalid_topic_3()
test_create_invalid_topic_4()
test_create_valid_topic()
class Quiz.test_view.CreateNewUserTest(methodName='runTest')

Bases: django.test.testcases.TestCase

This test case checks that a user is created properly

setUp()

Hook method for setting up the test fixture before exercising it.

test_create_invalid_users()

Test to see if an invalid user is not created

test_create_invalid_users_2()

Test to see if an invalid user is not created

test_create_valid_users()

Test to see if a valid user is created properly

class Quiz.test_view.DeleteQuestionTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Deleting a Question

setUp()

Hook method for setting up the test fixture before exercising it.

test_delete_valid_question()
test_delete_valid_question2()
class Quiz.test_view.DeleteTopicTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Deleting a Topic

setUp()

Hook method for setting up the test fixture before exercising it.

test_delete_invalid_topic()
test_delete_valid_topic()
class Quiz.test_view.GetAllTopicsTest(methodName='runTest')

Bases: django.test.testcases.TestCase

This test is to see if we can correctly get all the topics.

setUp()

Hook method for setting up the test fixture before exercising it.

test_get_all_topics()
class Quiz.test_view.GetQuestionTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Getting the user’s questions

setUp()

Hook method for setting up the test fixture before exercising it.

test_get_all_questions()
test_get_not_users_questions()
test_get_users_questions()
class Quiz.test_view.GetUsersTest(methodName='runTest')

Bases: django.test.testcases.TestCase

This test case checks that we can correctly return the users

setUp()

This is the setup method for tests, it creates all the objects we need

test_get_all_users()
class Quiz.test_view.QuestionsForTopic(methodName='runTest')

Bases: django.test.testcases.TestCase

Test moduel to check if we are correctly getting the information on questions per topic back

setUp()

Hook method for setting up the test fixture before exercising it.

test_number_of_questions()
class Quiz.test_view.RatingsTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test module to check if we are correctly posting ratings and if the api is returning the correct info when ratings are made

setUp()

Hook method for setting up the test fixture before exercising it.

test_post_rating()
test_post_rating_invalid()
test_rating_return()
class Quiz.test_view.StatisticsQuizTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test module to check if we are correctly getting the statistics from quizzes back

setUp()

Hook method for setting up the test fixture before exercising it.

test_username_topic()
class Quiz.test_view.UpdateQuestionTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Updating a Question

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_invalid_question()
test_update_valid_question()
class Quiz.test_view.UpdateTopicTest(methodName='runTest')

Bases: django.test.testcases.TestCase

Test Module for Updating a Topic

setUp()

Hook method for setting up the test fixture before exercising it.

test_update_invalid_topic()
test_update_valid_topic()

Quiz.urls module

Quiz.views module

All the views for our Quiz application.

Currently we support the following views:

  1. Questions - Called to get and add questions.

  2. QuestionMod - Called to get, update and delete a specific question.

  3. Topics - Called to get and add topics.

  4. TopicMod - Called to get, update and delete a specific topic.

  5. GenerateQuiz - Called to get a set of questions.

  6. Quiz - Called to get and add quizzes.

  7. Comment - Called to get and add comments.

  8. MyQuestionRatings - Called to get ratings for a question.

  9. StatsByTopic - Called to get statistics per topic.

Views are built with [Generic Views](https://www.django-rest-framework.org/api-guide/generic-views/#genericapiview) from the Django REST framework.

class Quiz.views.ChildCommentUpdateViewSet(**kwargs)

Bases: rest_framework.generics.UpdateAPIView

perform_update(serializer)
serializer_class

alias of Quiz.serializers.ChildCommentSerializer

class Quiz.views.ChildCommentViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

perform_create(serializer)
serializer_class

alias of Quiz.serializers.ChildCommentSerializer

class Quiz.views.CustomPagination

Bases: rest_framework.pagination.PageNumberPagination

get_paginated_response(data)
class Quiz.views.QuestionByIDViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

post(request, *args, **kwargs)
serializer_class

alias of Quiz.serializers.QuestionSerializer

class Quiz.views.QuestionByLearningOutcome(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of Quiz.serializers.QuestionLearningOutComeSerializer

class Quiz.views.QuestionIDByTopic(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of Quiz.serializers.QuestionSerializer

class Quiz.views.QuestionModViewSet(**kwargs)

Bases: rest_framework.generics.RetrieveUpdateDestroyAPIView

The QuestionModViewSet class defines the QuestionMod endpoint that allows the user to get, update and delete a specific question in the system.

get_queryset()

If required parameters are met, this function returns a specific question in the system.

The required parameters are:

  • id: Question ID.

lookup_field = '_id'
perform_update(serializer)

If required parameters are met, this function updates a specific question in the system.

queryset = []
serializer_class

alias of Quiz.serializers.QuestionSerializer

class Quiz.views.QuestionRatingsViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The QuestionRatingsViewSet class defines the MyQuestionRatings endpoint that allows the user to get and add ratings for a specific question in the system.

get(request, *args, **kwargs)

If required parameters are met, this function returns a set of ratings associated with the question in the system.

The required parameters are:

  • qid: Question ID.

perform_create(serializer)

If required parameters are met, this function adds a rating associated with a question in the system.

serializer_class

alias of Quiz.serializers.QuestionRatingsSerializer

class Quiz.views.QuestionViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The QuestionViewSet class defines the Questions endpoint that allows the user to get questions from the system and add questions to the system.

get_queryset()

Depending on the given parameters, this function returns a set of questions in the system either with pagination or without it.

The optional parameters are:

  • username: Username who created the question.

perform_create(serializer)

Add a Question

The function encrypts the prompt of a question to generate a unique ID for the question. If the question does not exist, the question will be added to the system. If it does, the question will not be added and the user will be prompted an error message.

queryset = []
serializer_class

alias of Quiz.serializers.QuestionSerializer

class Quiz.views.QuestionsForTopicAndLOCViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The QuestionsForTopicAndLOCViewSet defines the endpoint that allows for the user to see how many questions exist for a given topic or learningoutcome There are two arguments that may be passed to this function: - topic: the topic you want information on (optional) - learningOutcome: the learning Outcome you want information on (optional) If only a topic is provided, it will return stats on that topic, if a learningoutcome is also specified, it will return informatin on the topic and only that learning outcome if neither is specified, it will return info on all topics.

get(request, *args, **kwargs)
serializer_class

alias of Quiz.serializers.QuestionSerializer

class Quiz.views.ReviewQuizViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The ReviewQuizViewSet class defines the Quiz endpoint that allows the user to get and add quizzes in the system.

get_queryset()

If required parameters are met, this function returns a set of quizzes in the system.

The optional parameters are:

  • _id: Quiz ID.

  • username: Username who made the quiz.

perform_create(serializer)

If required parameters are met, this function adds a quiz to the system.

serializer_class

alias of Quiz.serializers.ReviewQuizSerializer

class Quiz.views.StatisticsByTopicViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The StatisticsByTopicViewSet defines the endpoint that allows for the user to obtain statistics on quizzes for topics. It returns the topic and how many right/wrong answers there are. The GET can take two arguments: - userId: the id of the user you want statistics on (optional) - topicId: the topic you want statistics on (optional) If both are provided, it will return stats on a specific user for a specific topic, if no user is provided, but a topic is, it will return stats on all users for the given topic, if a topic is not given, but a user is, it will return the stats on all topics for that user, if neither is given, it will return all stats on all quizzes that have been taken.

get(request, *args, **kwargs)
serializer_class

alias of Quiz.serializers.ReviewQuizSerializer

class Quiz.views.TopCommentUpdateViewSet(**kwargs)

Bases: rest_framework.generics.UpdateAPIView

perform_update(serializer)
serializer_class

alias of Quiz.serializers.TopCommentSerializer

class Quiz.views.TopCommentViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The TopCommentViewSet class defines the Comment endpoint that allows the user to get and add comments for a question in the system.

get_queryset()

If required parameters are met, this function returns a set of comments for a question in the system.

The optional parameters are:

  • questionID: Question ID.

lookup_field = '_id'
perform_create(serializer)

If required parameters are met, this function add a comment for a question in the system.

serializer_class

alias of Quiz.serializers.TopCommentSerializer

class Quiz.views.TopicLearningOutcomeViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

post(request, *args, **kwargs)
serializer_class

alias of Quiz.serializers.TopicLearningOutcomeSerializer

class Quiz.views.TopicModViewSet(**kwargs)

Bases: rest_framework.generics.RetrieveUpdateDestroyAPIView

The TopicModViewSet class defines the TopicMod endpoint that allows the user to get, update and delete a specific topic in the system.

get_queryset()

If required parameters are met, this function returns a specified topic in the system.

The required parameters are:

  • name: Topic name.

lookup_field = 'name'
perform_update(serializer)

If required parameters are met, this function updates a specified topic in the system.

The required parameters are:

  • name: Topic name.

queryset = []
serializer_class

alias of Quiz.serializers.TopicsSerializer

class Quiz.views.TopicViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The TopicViewSet class defines the Topics endpoint that allows the user to get and add topics in the system.

get_queryset()

If required parameters are met, this function returns a set of topics in the system.

The optional parameters are:

  • name: Topic name.

perform_create(serializer)

If required parameters are met, this function add a topic to the system.

queryset = []
serializer_class

alias of Quiz.serializers.TopicsSerializer

class Quiz.views.UserMadeQuestionRatingsViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

The UserMadeQuestionRatingsViewSet defines the endpoint that allows a user to see the ratings of their questions it takes two parameters: - username: the username of the person you want statistics on (optional) - qid: the question id you want information on (optional) if you want to see how all questions are rated for a user, you can provide their username, if you want to specifically see one question, you can provide the question id.

Note that at least one of them MUST be provided

get(request, *args, **kwargs)
perform_create(serializer)

If required parameters are met, this function adds a rating to the system.

serializer_class

alias of Quiz.serializers.QuestionRatingsSerializer

class Quiz.views.UsersViewSet(**kwargs)

Bases: rest_framework.generics.ListCreateAPIView

get_queryset()

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

perform_create(serializer)
querset = []
serializer_class

alias of Quiz.serializers.UsersSerializer

Module contents