documents package¶
Subpackages¶
Submodules¶
documents.admin module¶
Registers admin interfaces for the documents module
-
class
documents.admin.
AnnualDocumentAdmin
(model, admin_site)[source]¶ Bases:
utils.translation.TranslatedModelAdmin
Manage the annual documents
-
exclude
= None¶
-
fields
= None¶
-
form
¶ alias of
documents.forms.AnnualDocumentForm
-
list_filter
= (<class 'documents.admin.LectureYearFilter'>, 'created', 'last_updated')¶
-
property
media
¶
-
search_fields
= ()¶
-
-
class
documents.admin.
AssociationDocumentAdmin
(model, admin_site)[source]¶ Bases:
utils.translation.TranslatedModelAdmin
Manage the association documents
-
exclude
= None¶
-
fields
= None¶
-
form
¶
-
list_filter
= ('created', 'last_updated')¶
-
property
media
¶
-
search_fields
= ()¶
-
-
class
documents.admin.
EventDocumentAdmin
(model, admin_site)[source]¶ Bases:
utils.translation.TranslatedModelAdmin
Manage the event documents
-
exclude
= None¶
-
fields
= None¶
-
form
¶ alias of
documents.forms.EventDocumentForm
-
has_change_permission
(request, document=None)[source]¶ Only allow access to the change form if the user is an owner
-
has_delete_permission
(request, document=None)[source]¶ Only allow delete access if the user is an owner
-
list_filter
= ('created', 'last_updated')¶
-
property
media
¶
-
search_fields
= ()¶
-
-
class
documents.admin.
GeneralMeetingAdmin
(model, admin_site)[source]¶ Bases:
utils.translation.TranslatedModelAdmin
Manage the general meetings
-
exclude
= None¶
-
fields
= None¶
-
form
¶ alias of
documents.forms.GeneralMeetingForm
-
inlines
= [<class 'documents.admin.MinutesInline'>]¶
-
list_filter
= ('datetime',)¶
-
property
media
¶
-
search_fields
= ()¶
-
-
class
documents.admin.
LectureYearFilter
(request, params, model, model_admin)[source]¶ Bases:
django.contrib.admin.filters.SimpleListFilter
Filter the memberships on those started or ended in a lecture year
-
lookups
(request, model_admin)[source]¶ Must be overridden to return a list of tuples (value, verbose value)
-
parameter_name
= 'lecture_year'¶
-
title
= 'lecture year'¶
-
-
class
documents.admin.
MinutesInline
(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.StackedInline
Inline for minutes of a general meeting
-
extra
= 0¶
-
form
¶ alias of
documents.forms.MinutesForm
-
property
media
¶
-
model
¶ alias of
documents.models.Minutes
-
documents.apps module¶
documents.forms module¶
The forms defined by the documents package
-
class
documents.forms.
AnnualDocumentForm
(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.ModelForm
Form that provides custom functionality for annual documents
-
class
Meta
[source]¶ Bases:
object
-
exclude
= ()¶
-
model
¶ alias of
documents.models.AnnualDocument
-
widgets
= {'file_en': <class 'documents.forms.DocumentFileInput'>, 'file_nl': <class 'documents.forms.DocumentFileInput'>, 'year': <class 'django.forms.widgets.Select'>}¶
-
-
base_fields
= {'category': <django.forms.fields.TypedChoiceField object>, 'file_en': <django.forms.fields.FileField object>, 'file_nl': <django.forms.fields.FileField object>, 'members_only': <django.forms.fields.BooleanField object>, 'name_en': <django.forms.fields.CharField object>, 'name_nl': <django.forms.fields.CharField object>, 'subcategory': <django.forms.fields.TypedChoiceField object>, 'year': <django.forms.fields.TypedChoiceField object>}¶
-
declared_fields
= {'year': <django.forms.fields.TypedChoiceField object>}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
-
class
documents.forms.
AssociationDocumentForm
(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.ModelForm
Form that overrides the widgets for the files
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('name_en', 'name_nl', 'file_en', 'file_nl', 'members_only')¶
-
model
¶ alias of
documents.models.AssociationDocument
-
widgets
= {'file_en': <class 'documents.forms.DocumentFileInput'>, 'file_nl': <class 'documents.forms.DocumentFileInput'>}¶
-
-
base_fields
= {'file_en': <django.forms.fields.FileField object>, 'file_nl': <django.forms.fields.FileField object>, 'members_only': <django.forms.fields.BooleanField object>, 'name_en': <django.forms.fields.CharField object>, 'name_nl': <django.forms.fields.CharField object>}¶
-
declared_fields
= {}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
-
class
documents.forms.
DocumentFileInput
(attrs=None)[source]¶ Bases:
django.forms.widgets.ClearableFileInput
Wrapper around Django’s
ClearableFileInput
It overrides the URL of the associated file when it is fetched.
-
property
media
¶
-
template_name
= 'widgets/clearable_file_input.html'¶
-
property
-
class
documents.forms.
EventDocumentForm
(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.ModelForm
Form that overrides the widgets for the files
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('name_en', 'name_nl', 'file_en', 'file_nl', 'members_only', 'owner')¶
-
model
¶ alias of
documents.models.EventDocument
-
widgets
= {'file_en': <class 'documents.forms.DocumentFileInput'>, 'file_nl': <class 'documents.forms.DocumentFileInput'>}¶
-
-
base_fields
= {'file_en': <django.forms.fields.FileField object>, 'file_nl': <django.forms.fields.FileField object>, 'members_only': <django.forms.fields.BooleanField object>, 'name_en': <django.forms.fields.CharField object>, 'name_nl': <django.forms.fields.CharField object>, 'owner': <django.forms.models.ModelChoiceField object>}¶
-
declared_fields
= {}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
-
class
documents.forms.
GeneralMeetingForm
(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.ModelForm
Custom form for general meetings with a custom widget for documents
-
class
Meta
[source]¶ Bases:
object
-
exclude
= ()¶
-
model
¶ alias of
documents.models.GeneralMeeting
-
widgets
= {'documents': <django.contrib.admin.widgets.FilteredSelectMultiple object>}¶
-
-
base_fields
= {'datetime': <django.forms.fields.DateTimeField object>, 'documents': <django.forms.models.ModelMultipleChoiceField object>, 'location_en': <django.forms.fields.CharField object>, 'location_nl': <django.forms.fields.CharField object>}¶
-
declared_fields
= {}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
-
class
documents.forms.
MinutesForm
(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.ModelForm
Form that overrides the widgets for the files
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('file_nl', 'file_en', 'members_only')¶
-
model
¶ alias of
documents.models.Minutes
-
widgets
= {'file_en': <class 'documents.forms.DocumentFileInput'>, 'file_nl': <class 'documents.forms.DocumentFileInput'>}¶
-
-
base_fields
= {'file_en': <django.forms.fields.FileField object>, 'file_nl': <django.forms.fields.FileField object>, 'members_only': <django.forms.fields.BooleanField object>}¶
-
declared_fields
= {}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
-
class
documents.forms.
MiscellaneousDocumentForm
(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.ModelForm
Form that overrides the widgets for the files
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('name_en', 'name_nl', 'file_en', 'file_nl', 'members_only')¶
-
model
¶
-
widgets
= {'file_en': <class 'documents.forms.DocumentFileInput'>, 'file_nl': <class 'documents.forms.DocumentFileInput'>}¶
-
-
base_fields
= {'file_en': <django.forms.fields.FileField object>, 'file_nl': <django.forms.fields.FileField object>, 'members_only': <django.forms.fields.BooleanField object>, 'name_en': <django.forms.fields.CharField object>, 'name_nl': <django.forms.fields.CharField object>}¶
-
declared_fields
= {}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
documents.models module¶
-
class
documents.models.
AnnualDocument
(*args, **kwargs)[source]¶ Bases:
documents.models.Document
Describes an annual document
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
SUBCATEGORIES
= (('report', 'Annual report'), ('financial', 'Financial report'), ('policy', 'Policy document'))¶
-
document_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
document_ptr_id
¶
-
get_subcategory_display
(*, field=<django.db.models.fields.CharField: subcategory>)¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
subcategory
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
year
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
documents.models.
AssociationDocument
(*args, **kwargs)[source]¶ Bases:
documents.models.Document
Describes an association document
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <documents.models.AssociationDocumentManager object>¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
exception
-
class
documents.models.
AssociationDocumentManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
Custom manager to filter for association documents
-
class
documents.models.
Document
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Describes a base document
-
DOCUMENT_CATEGORIES
= (('annual', 'Annual document'), ('association', 'Association document'), ('event', 'Event document'), ('minutes', 'Minutes'), ('misc', 'Miscellaneous document'))¶
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
annualdocument
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
category
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
event_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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
eventdocument
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
property
file
¶ Accessor that fetches the localized variant of file
-
file_en
¶ 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)
-
file_nl
¶ 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)
-
generalmeeting_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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
get_category_display
(*, field=<django.db.models.fields.CharField: category>)¶
-
get_next_by_created
(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
-
get_next_by_last_updated
(*, field=<django.db.models.fields.DateTimeField: last_updated>, is_next=True, **kwargs)¶
-
get_previous_by_created
(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
-
get_previous_by_last_updated
(*, field=<django.db.models.fields.DateTimeField: last_updated>, 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.
-
last_updated
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
members_only
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
minutes
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
property
name
¶ Accessor that fetches the localized variant of name
-
name_en
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
name_nl
¶ 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>¶
-
-
class
documents.models.
EventDocument
(*args, **kwargs)[source]¶ Bases:
documents.models.Document
Describes a document for events
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
document_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
document_ptr_id
¶
-
owner
¶ 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 aForwardManyToOneDescriptor
instance.
-
owner_id
¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
exception
-
class
documents.models.
GeneralMeeting
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Describes a general meeting
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
datetime
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
documents
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
get_next_by_datetime
(*, field=<django.db.models.fields.DateTimeField: datetime>, is_next=True, **kwargs)¶
-
get_previous_by_datetime
(*, field=<django.db.models.fields.DateTimeField: datetime>, 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.
-
property
location
¶ Accessor that fetches the localized variant of location
-
location_en
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
location_nl
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
minutes
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
documents.models.
Minutes
(*args, **kwargs)[source]¶ Bases:
documents.models.Document
Describes a minutes document
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
document_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
document_ptr_id
¶
-
meeting
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
meeting_id
¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
exception
-
class
documents.models.
MiscellaneousDocument
(*args, **kwargs)[source]¶ Bases:
documents.models.Document
Describes a miscellaneous document
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <documents.models.MiscellaneousDocumentManager object>¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
exception
documents.sitemaps module¶
The sitemaps defined by the documents package
-
class
documents.sitemaps.
MiscellaneousDocumentsSitemap
[source]¶ Bases:
django.contrib.sitemaps.Sitemap
Sitemap for misc documents
documents.urls module¶
The routes defined by the documents package
documents.views module¶
Views provided by the documents package
-
class
documents.views.
DocumentDownloadView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
View that allows you to download a specific document based on it’s and your permissions settings
-
get
(request, *args, **kwargs) → django.http.response.HttpResponse[source]¶ - Returns
either a 302 redirect to the login page or
a 200 with the document
-
model
¶ alias of
documents.models.Document
-