finances.models module

class finances.models.Subsidy(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A subsidy given to SciPost by an Organization. Any fund given to SciPost, in any form, must be associated to a corresponding Subsidy instance.

This can for example be:

  • a Sponsorship agreement

  • an incidental grant

  • a development grant for a specific purpose

  • a Collaboration Agreement

  • a donation

The date field represents the date at which the Subsidy was formally agreed, or (e.g. for Sponsorship Agreements) the date at which the agreement enters into force. The date_until field is optional, and represents (where applicable) the date after which the object of the Subsidy is officially terminated.

organization

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.

subsidy_type

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

description

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

amount

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

amount_publicly_shown

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

status

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.

date_until

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

renewable

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

renewal_of

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 and Topping.pizzas are ManyToManyDescriptor instances.

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

get_absolute_url()[source]
value_in_year(year)[source]

Normalize the value of the subsidy per year.

property renewal_action_date
property renewal_action_date_color_class
property date_until_color_class
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

attachments

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.

get_next_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=True, **kwargs)
get_previous_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=False, **kwargs)
get_status_display(*, field=<django.db.models.fields.CharField: status>)
get_subsidy_type_display(*, field=<django.db.models.fields.CharField: subsidy_type>)
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>
organization_id
renewed_by

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 and Topping.pizzas are ManyToManyDescriptor instances.

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

finances.models.subsidy_attachment_path(instance, filename)[source]

Save the uploaded SubsidyAttachments to country-specific folders.

class finances.models.SubsidyAttachment(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A document related to a Subsidy.

attachment

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)
name

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

subsidy

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.

publicly_visible

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

get_absolute_url()[source]
visible_to_user(current_user)[source]
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>
subsidy_id
class finances.models.WorkLog(id, user, comments, log_type, duration, work_date, created, content_type, object_id)[source]

Bases: django.db.models.base.Model

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.

comments

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

log_type

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

duration

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

work_date

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.

content_type

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.

object_id

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

content

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

property slug
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

content_type_id
get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)
get_next_by_work_date(*, field=<django.db.models.fields.DateField: work_date>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)
get_previous_by_work_date(*, field=<django.db.models.fields.DateField: work_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>
streams

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.

user_id