education package¶
Submodules¶
education.admin module¶
This module registers admin pages for the models.
-
class
education.admin.CourseAdmin(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin-
fields= ('name', 'course_code', 'ec', 'since', 'until', 'categories', 'old_courses')¶
-
list_filter= ('categories', 'ec')¶
-
property
media¶
-
search_fields= ('name', 'course_code')¶
-
-
class
education.admin.ExamAdmin(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin,education.admin.WithDownloadCsv-
actions= ['accept', 'reject', 'reset_download_count', 'download_csv']¶
-
list_display= ('type', 'course', 'exam_date', 'uploader', 'accepted', 'language', 'download_count')¶
-
list_filter= ('accepted', 'exam_date', 'type', 'language')¶
-
property
media¶
-
readonly_fields= ('download_count',)¶
-
search_fields= ('name', 'uploader__first_name', 'uploader__last_name', 'course__name')¶
-
-
class
education.admin.SummaryAdmin(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin,education.admin.WithDownloadCsv-
actions= ['accept', 'reject', 'reset_download_count', 'download_csv']¶
-
form¶ alias of
education.forms.SummaryAdminForm
-
list_display= ('name', 'course', 'uploader', 'accepted', 'language', 'download_count')¶
-
list_filter= ('accepted', 'language')¶
-
property
media¶
-
readonly_fields= ('download_count',)¶
-
search_fields= ('name', 'uploader__first_name', 'uploader__last_name', 'course__name')¶
-
education.apps module¶
Configuration for the education package.
education.forms module¶
The forms defined by the education package.
-
class
education.forms.AddExamForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelFormCustom form to add exams, changes the possible years of the date.
-
class
Meta[source]¶ Bases:
object-
fields= ('file', 'course', 'type', 'language', 'exam_date')¶
-
model¶ alias of
education.models.Exam
-
-
base_fields= {'course': <django.forms.models.ModelChoiceField object>, 'exam_date': <django.forms.fields.DateField object>, 'file': <django.forms.fields.FileField object>, 'language': <django.forms.fields.TypedChoiceField object>, 'type': <django.forms.fields.ChoiceField object>}¶
-
declared_fields= {'course': <django.forms.models.ModelChoiceField object>, 'exam_date': <django.forms.fields.DateField object>, 'type': <django.forms.fields.ChoiceField object>}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
this_year= 2020¶
-
years= [2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012]¶
-
class
-
class
education.forms.AddSummaryForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelFormCustom form to add summaries, orders courses by name and formats the year as lecture years.
-
class
Meta[source]¶ Bases:
object-
fields= ('name', 'year', 'language', 'file', 'course', 'author')¶
-
model¶ alias of
education.models.Summary
-
-
base_fields= {'author': <django.forms.fields.CharField object>, 'course': <django.forms.models.ModelChoiceField object>, 'file': <django.forms.fields.FileField object>, 'language': <django.forms.fields.TypedChoiceField object>, 'name': <django.forms.fields.CharField object>, 'year': <django.forms.fields.TypedChoiceField object>}¶
-
declared_fields= {'course': <django.forms.models.ModelChoiceField object>, 'year': <django.forms.fields.TypedChoiceField object>}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
this_year= 2020¶
-
years= <list_reverseiterator object>¶
-
class
-
class
education.forms.SummaryAdminForm(data=None, files=None, **kwargs)[source]¶ Bases:
django.forms.models.ModelFormCustom form for summaries so that we can show more data in the admin.
-
base_fields= {'accepted': <django.forms.fields.BooleanField object>, 'author': <django.forms.fields.CharField object>, 'course': <django.forms.models.ModelChoiceField object>, 'download_count': <django.forms.fields.IntegerField object>, 'email': <django.forms.fields.CharField object>, 'file': <django.forms.fields.FileField object>, 'language': <django.forms.fields.TypedChoiceField object>, 'name': <django.forms.fields.CharField object>, 'phone': <django.forms.fields.CharField object>, 'uploader': <django.forms.models.ModelChoiceField object>, 'uploader_date': <django.forms.fields.DateField object>, 'year': <django.forms.fields.IntegerField object>}¶
-
declared_fields= {'email': <django.forms.fields.CharField object>, 'phone': <django.forms.fields.CharField object>}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
education.models module¶
The models defined by the education package.
-
class
education.models.Category(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelDescribes a course category.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
course_set¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
id¶ 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>¶
-
exception
-
class
education.models.Course(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelDescribes a course.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
categories¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
course_code¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
course_set¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
ec¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exam_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
id¶ 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>¶
-
old_courses¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
since¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
summary_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
until¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
education.models.Exam(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelDescribes an exam.
-
exception
DoesNotExist¶
-
EXAM_TYPES= (('document', 'Document'), ('exam', 'Exam'), ('partial', 'Partial Exam'), ('resit', 'Resit'), ('practice', 'Practice Exam'), ('exam_answers', 'Exam Answers'), ('partial_answers', 'Partial Exam Answers'), ('resit_answers', 'Resit Answers'), ('practice_answers', 'Practice Exam Answers'))¶
-
exception
MultipleObjectsReturned¶
-
accepted¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
course¶ 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.parentis aForwardManyToOneDescriptorinstance.
-
course_id¶
-
download_count¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exam_date¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file¶ The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
-
get_language_display(*, field=<django.db.models.fields.CharField: language>)¶
-
get_next_by_exam_date(*, field=<django.db.models.fields.DateField: exam_date>, is_next=True, **kwargs)¶
-
get_next_by_uploader_date(*, field=<django.db.models.fields.DateField: uploader_date>, is_next=True, **kwargs)¶
-
get_previous_by_exam_date(*, field=<django.db.models.fields.DateField: exam_date>, is_next=False, **kwargs)¶
-
get_previous_by_uploader_date(*, field=<django.db.models.fields.DateField: uploader_date>, is_next=False, **kwargs)¶
-
get_type_display(*, field=<django.db.models.fields.CharField: type>)¶
-
id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
language¶ 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>¶
-
type¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
uploader¶ 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.parentis aForwardManyToOneDescriptorinstance.
-
uploader_date¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
uploader_id¶
-
property
year¶
-
exception
-
class
education.models.Summary(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelDescribes a summary.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
accepted¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
course¶ 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.parentis aForwardManyToOneDescriptorinstance.
-
course_id¶
-
download_count¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file¶ The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
-
get_language_display(*, field=<django.db.models.fields.CharField: language>)¶
-
get_next_by_uploader_date(*, field=<django.db.models.fields.DateField: uploader_date>, is_next=True, **kwargs)¶
-
get_previous_by_uploader_date(*, field=<django.db.models.fields.DateField: uploader_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.
-
language¶ 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>¶
-
uploader¶ 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.parentis aForwardManyToOneDescriptorinstance.
-
uploader_date¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
uploader_id¶
-
year¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
education.sitemaps module¶
The sitemaps defined by the education package.
-
class
education.sitemaps.CourseSitemap[source]¶ Bases:
django.contrib.sitemaps.SitemapSitemap of the course pages.
education.urls module¶
The routes defined by the education package.
education.views module¶
Views provided by the education package.
-
class
education.views.BookInfoView(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateViewRender a page with information about book sale.
Only available to members and to-be members
-
template_name= 'education/books.html'¶
-
-
class
education.views.CourseDetailView(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailViewRender the detail page of one specific course.
-
context_object_name= 'course'¶
-
model¶ alias of
education.models.Course
-
template_name= 'education/course.html'¶
-
-
class
education.views.CourseIndexView(**kwargs)[source]¶ Bases:
django.views.generic.list.ListViewRender an overview of the courses.
-
queryset¶
-
template_name= 'education/courses.html'¶
-
-
class
education.views.ExamCreateView(**kwargs)[source]¶ Bases:
django.contrib.messages.views.SuccessMessageMixin,django.views.generic.edit.CreateViewRender the form to submit a new exam.
-
dispatch(request, *args, **kwargs)¶
-
form_class¶ alias of
education.forms.AddExamForm
-
form_valid(form) → django.http.response.HttpResponse[source]¶ If the form is valid, save the associated model.
-
model¶ alias of
education.models.Exam
-
success_message= 'Exam submitted successfully.'¶
-
success_url= '/education/courses/exam/upload/'¶
-
template_name= 'education/add_exam.html'¶
-
-
class
education.views.ExamDetailView(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailViewFetch and output the specified exam.
-
dispatch(request, *args, **kwargs)¶
-
model¶ alias of
education.models.Exam
-
-
class
education.views.StudentParticipantView(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateViewRenders a page with information about student information.
-
template_name= 'education/student_participation.html'¶
-
-
class
education.views.SummaryCreateView(**kwargs)[source]¶ Bases:
django.contrib.messages.views.SuccessMessageMixin,django.views.generic.edit.CreateViewRender the form to submit a new summary.
-
dispatch(request, *args, **kwargs)¶
-
form_class¶ alias of
education.forms.AddSummaryForm
-
form_valid(form) → django.http.response.HttpResponse[source]¶ If the form is valid, save the associated model.
-
model¶ alias of
education.models.Summary
-
success_message= 'Summary submitted successfully.'¶
-
success_url= '/education/courses/summary/upload/'¶
-
template_name= 'education/add_summary.html'¶
-
-
class
education.views.SummaryDetailView(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailViewFetch and output the specified summary.
-
dispatch(request, *args, **kwargs)¶
-
model¶ alias of
education.models.Summary
-