(edit the images umldiagram1 and umldiagram2 using yuml.me)
Path separator used by node-paths. The value is '.', and it must not be changed.
Split the path on pathsep and return the resulting list. Example:
>>> splitpath('uio.ifi.matnat')
['uio', 'ifi', 'matnat']
>>> splitpath('uio.ifi.matnat', expected_len=2)
Traceback (most recent call last):
...
ValueError: Path must have exactly 2 parts
Parameters: | expected_len – Expected length of the resulting list. If the resulting list is not exactly the given length, ValueError is raised. If expected_len is 0 (default), no checking is done. |
---|
Bases: devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin, devilry.apps.core.models.save_interface.SaveInterface
The base class of the Devilry hierarchy. Implements basic functionality used by the other Node classes. This is an abstract datamodel, so it is never used directly.
A django.db.models.SlugField with max 20 characters. Only numbers, letters, ‘_’ and ‘-‘.
A django.db.models.CharField with max 100 characters. Gives a longer description than short_name.
Bases: object
Abstract class implemented by all classes where it is natural to need to check if a user has admin rights.
Get a django.db.models.Q object matching all objects of this type where the given user is admin. The matched result is not guaranteed to contain unique items, so you should use distinct() on the queryset if this is required.
This must be implemented in all subclassed.
Get all objects of this type where the given user is admin.
Get all objects of this type where the given user is admin, or all objects if the user is superadmin.
Bases: object
Abstract class implemented by all classes where it is natural to need to check if a user is examiner.
Return a django.models.Q object which matches all items of this type where Assignment.publishing_time is in the past.
Parameters: |
|
---|
Return a django.models.Q object which matches items where the given user is examiner.
Get all items of this type where the given user_obj is examiner on one of the assignment groups.
Parameters: | user_obj – A django.contrib.auth.models.User object. |
---|---|
Return type: | QuerySet |
Get all published <assignment-classifications>` items of this type where the given user_obj is examiner on one of the assignment groups. Combines q_is_examiner() and q_published().
Parameters: |
|
---|---|
Returns: | A django.db.models.query.QuerySet with duplicate assignments eliminated. |
Shortcut for published_where_is_examiner() with old=False.
Shortcut for published_where_is_examiner() with active=False.
A node at the top of the navigation tree. It is a generic element used to organize administrators. A Node can be organized below another Node, and it can only have one parent.
Let us say you use Devilry within two departments at Fantasy University; informatics and mathematics. The university has an administration, and each department have their own administration. You would end up with this node-hierarchy:
- Fantasy University
- Department of informatics
- Department of mathematics
Bases: django.db.models.base.Model, devilry.apps.core.models.basenode.BaseNode, devilry.apps.core.models.model_utils.Etag
This class is typically used to represent a hierarchy of institutions, faculties and departments.
A django.db.models.ForeignKey that points to the parent node, which is always a Node.
A django.db.models.ManyToManyField that holds all the admins of the Node.
A DateTimeField containing the etag for this object.
Recursively iterates over all child nodes, and their child nodes. For a list of direct child nodes, use atribute child_nodes instead.
Validate the node, making sure it does not do something stupid.
Always call this before save()! Read about validation here: http://docs.djangoproject.com/en/dev/ref/models/instances/#id1
Raises ValidationError if:
- The node is it’s own parent.
- The node is the child of itself or one of its childnodes.
A subject is a course, seminar, class or something else being given regularly. A subject is further divided into periods.
Bases: django.db.models.base.Model, devilry.apps.core.models.basenode.BaseNode, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate, devilry.apps.core.models.model_utils.Etag
A django.db.models.ForeignKey that points to the parent node, which is always a Node.
A django.db.models.ManyToManyField that holds all the admins of the Node.
A django.db.models.SlugField with max 20 characters. Only numbers, letters, ‘_’ and ‘-‘. Unlike all other children of BaseNode, Subject.short_name is unique. This is mainly to avoid the overhead of having to recurse all the way to the top of the node hierarchy for every unique path.
A DateTimeField containing the etag for this object.
Only returns short_name for subject since it is guaranteed to be unique.
A Period is a limited period of time, like spring 2009, week 34 2010 or even a single day.
Bases: django.db.models.base.Model, devilry.apps.core.models.basenode.BaseNode, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate, devilry.apps.core.models.model_utils.Etag
A Period represents a period of time, for example a half-year term at a university.
A django.db.models.ForeignKey that points to the parent node, which is always a Subject.
A django.db.models.DateTimeField representing the starting time of the period.
A django.db.models.DateTimeField representing the ending time of the period.
A django.db.models.ManyToManyField that holds all the admins of the node.
A set of assignments for this period.
A DateTimeField containing the etag for this object.
A django.db.models.ForeignKey that points to the related students for this period.
A django.db.models.ForeignKey that points to the related examiners for this period.
Validate the period.
Always call this before save()! Read about validation here: http://docs.djangoproject.com/en/dev/ref/models/instances/#id1
Raises ValidationError if start_time is after end_time.
Returns true if the period is active
Represents one assignment within a given Period in a given Subject. Each assignment contains one AssignmentGroup for each student or group of students permitted to submit deliveries.
We have three main classifications of assignments:
Bases: django.db.models.base.Model, devilry.apps.core.models.basenode.BaseNode, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate, devilry.apps.core.models.model_utils.Etag
A django.db.models.ForeignKey that points to the parent node, which is always a Period.
A django.db.models.DateTimeField representing the publishing time of the assignment.
A models.BooleanField specifying if the assignment should be anonymously for correcters.
A django.db.models.ManyToManyField that holds all the admins of the Node.
A set of assignmentgroups for this assignment
Should feedbacks published by examiners be made avalable to the students immediately? If not, an administrator have to publish feedbacks. See also Deadline.feedbacks_published.
A DateTimeField containing the etag for this object.
If the anonymous flag is changed, update the identifer on all the candidates on this assignment.
Validate the assignment.
Always call this before save()! Read about validation here: http://docs.djangoproject.com/en/dev/ref/models/instances/#id1
Raises ValidationError if publishing_time is not between Period.start_time and Period.end_time.
Bases: django.db.models.base.Model, devilry.apps.core.models.model_utils.Etag, devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin
The AssignmentGroup where this groups belongs.
A student (a foreign key to a User).
A optional candidate id. This can be anything as long as it is not more than 30 characters. When the assignment is anonymous, this is the “name” shown to examiners instead of the username of the student.
Bases: django.db.models.base.Model, devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.model_utils.Etag
Represents a student or a group of students.
A django.db.models.ForeignKey that points to the parent node, which is always an Assignment.
An optional name for the group.
A django RelatedManager that holds the candidates on this group.
A django.db.models.ManyToManyField that holds the examiner(s) that are to correct and grade the assignment.
A django.db.models.BooleanField that tells you if the group can add deliveries or not.
A django RelatedManager that holds the tags on this group.
The last StaticFeedback (by save timestamp) on this assignmentgroup.
A DateTimeField containing the etag for this object.
Returns a django.models.Q object matching AssignmentGroups where the given student is candidate.
Returns a QuerySet matching all AssignmentGroups where the given user is student.
Parameters: | user_obj – A django.contrib.auth.models.User object. |
---|---|
Return type: | QuerySet |
Returns a QuerySet matching all published assignment groups where the given user is student.
Parameters: | user_obj – A django.contrib.auth.models.User object. |
---|---|
Return type: | QuerySet |
Returns a QuerySet matching all active assignment groups where the given user is student.
Parameters: | user_obj – A django.contrib.auth.models.User object. |
---|---|
Return type: | QuerySet |
Returns a QuerySet matching all old assignment groups where the given user is student.
Parameters: | user_obj – A django.contrib.auth.models.User object. |
---|---|
Return type: | QuerySet |
Get a string containing all students in the group separated by comma and a space, like: superman, spiderman, batman.
WARNING: You should never use this method when the user is not an administrator. Use get_candidates() instead.
Get a string containing all candiates in the group separated by comma and a space, like: superman, spiderman, batman for normal assignments, and something like: 321, 1533, 111 for anonymous assignments.
Get a string contaning all examiners in the group separated by comma (',').
Return True if user is examiner on this assignment group
Get the active Deadline.
This is always the last deadline on this group.
Returns: | The latest deadline. |
---|
Check if the user has permission to save this AssignmentGroup.
Returns true if a student can add deliveries on this assignmentgroup
Both the assignmentgroups is_open attribute, and the periods start and end time is checked.
Each AssignmentGroup have zero or more deadlines.
Bases: django.db.models.base.Model, devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate
A deadline on an AssignmentGroup. A deadline contains zero or more deliveries, the time of the deadline and an optional text.
The AssignmentGroup where the deadline is registered.
The deadline a DateTimeField.
A optional deadline text.
A django RelatedManager that holds the deliveries on this group.
Should deliveries on this deadline be available to examiners before the deadline expires? This is set by students.
If this boolean field is True, the student can see all StaticFeedback objects associated with this Deadline through a Delivery. See also Assignment.examiners_publish_feedbacks_directly.
Validate the deadline.
Always call this before save()! Read about validation here: http://docs.djangoproject.com/en/dev/ref/models/instances/#id1
Raises ValidationError if:
- deadline is before Assignment.publishing_time.
- deadline is not before Period.end_time.
Simple example:
assignmentgroup = AssignmentGroup.objects.get(id=1)
assignmentgroup.deliveries.create(delivered_by=student1,
successful=True)
More advanced example:
assignmentgroup = AssignmentGroup.objects.get(id=1)
delivery = assignmentgroup.deliveries.create(delivered_by=student1,
successful=False)
delivery.add_file('test.py', ['print', 'hello world'])
delivery.add_file('test2.py', ['print "hi"'])
delivery.successful = True
delivery.save()
The input to add_file() will normally be a file-like object, but as shown above it can be anything you want.
Bases: django.db.models.base.Model, devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer
A class representing a given delivery from an AssignmentGroup.
A django.db.models.DateTimeField that holds the date and time the Delivery was uploaded.
A django.db.models.ForeignKey pointing to the Deadline for this Delivery.
A django.db.models.fields.PositiveIntegerField with the delivery-number within this assignment-group. This number is automatically incremented within each assignmentgroup, starting from 1. Must be unique within the assignment-group. Automatic incrementation is used if number is None when calling save().
A django.db.models.ForeignKey pointing to the user that uploaded the Delivery
A django.db.models.BooleanField telling whether or not the Delivery was successfully uploaded.
A django.db.models.BooleanField telling whether or not the Delivery was delived after deadline..
A DateTimeField containing the etag for this object.
Compares the deadline and time of delivery. If time_of_delivery is greater than the deadline, return True.
Returns a django.models.Q object matching Deliveries where the given student is candidate.
Add a file to the delivery.
Parameters: |
|
---|
Bases: django.db.models.base.Model, devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate
Represents a feedback for a Delivery.
Each delivery can have zero or more feedbacks. Each StaticFeedback object stores static data that an examiner has published on a delivery. StaticFeedback is created and edited in a grade+feedback editor in a grade plugin, and when an examiner choose to publish feedback, a static copy of the data he/she created in the grade+feedback editor is stored in a StaticFeedback.
Feedbacks are only visible to students when Deadline.feedbacks_published on the related deadline is True. Feedbacks are related to Deadlines through its delivery.
Students are presented with the last feedback on a delivery, however they can browse every StaticFeedback on their deliveries. This history is to protect the student from administrators or examiners that change published feedback to avoid that a student can make an issue out of a bad feedback.
NOTE: When a StaticFeedback is saved, the corresponding AssignmentGroup.feedback is updated to the newly created StaticFeedback.
The rendered HTML view.
The django.contrib.auth.models.User that created the StaticFeedback.
Date/time when this feedback was created.
A django.db.models.ForeignKey that points to the Delivery where this feedback belongs.
The grade as a short string (max 12 chars).
The number of points (integer).
Boolean is passing grade?
Returns a django.models.Q object matching Deliveries where the given student is candidate.
Returns a django.models.Q object matching Feedbacks where the given student is candidate.
Bases: django.db.models.base.Model, devilry.apps.core.models.abstract_is_admin.AbstractIsAdmin, devilry.apps.core.models.abstract_is_examiner.AbstractIsExaminer, devilry.apps.core.models.abstract_is_candidate.AbstractIsCandidate
Represents the metadata for a file belonging to a Delivery.
A file meta is just information about a single file, which is stored in a deliverystore. Use the deliverystore to manage the file stored in its physical location. Example:
filemeta = FileMeta.objects.get(pk=0)
if filemeta.deliverystore.exists(filemeta):
filemeta.deliverystore.remove(filemeta)
# Write or read just as with the builtin open()
fobj = filemeta.deliverystore.write_open(filemeta)
fobj.write('Hello')
fobj.write('World')
fobj.close()
fobj = filemeta.deliverystore.read_open(filemeta)
print fobj.read()
See DeliveryStore for more details on deliverystores.
A django.db.models.ForeignKey that points to the Delivery of the given feedback.
Name of the file.
Size of the file in bytes.
The current DeliveryStore. Class variable.