beat.web.code.models module

class beat.web.code.models.CodeManager[source]

Bases: beat.web.common.models.StoredContributionManager

create_object(author, name, short_description='', description='', declaration=None, code=None, version=1, previous_version=None, fork_of=None)[source]
for_user(user, add_public=False)[source]
for_team(team)[source]
from_author(user, author_name, add_public=False)[source]
create_code(author, name, default, short_description='', description='', declaration=None, code=None, version=1, previous_version=None, fork_of=None)[source]
beat.web.code.models.get_contribution_source_code_filename(obj, path)[source]
beat.web.code.models.set_source_code(instance, value)[source]
beat.web.code.models.get_source_code(instance)[source]
beat.web.code.models.AccessibilityInfo

alias of beat.web.code.models.Accessibility

class beat.web.code.models.Code(*args, **kwargs)[source]

Bases: beat.web.common.models.StoredContribution

UNKNOWN = 'U'
CXX = 'C'
MATLAB = 'M'
PYTHON = 'P'
R = 'R'
CODE_LANGUAGE = (('U', 'Unknown'), ('C', 'Cxx'), ('M', 'Matlab'), ('P', 'Python'), ('R', 'R'))
CODE_NAMES = {'C': 'C++'}
usable_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.

usable_by_team

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.

language

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

objects
class Meta[source]

Bases: beat.web.common.models.Meta

abstract = False
validate(declaration)[source]
source_code_filename()[source]
share(public, users=None, teams=None)[source]
is_accessible(public, users=None, teams=None)[source]
sharing_preferences()[source]
open_source(user)[source]

Tells if a given user can view the code of this contribution

is_binary()[source]
language_fullname()[source]
json_language()[source]
static language_identifier(db_language)[source]
static language_db(language_identifier)[source]
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.

property source_code
author

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.

fork_of

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.

get_language_display(*, field=<django.db.models.fields.CharField: language>)
get_next_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=True, **kwargs)
get_previous_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=False, **kwargs)
get_sharing_display(*, field=<django.db.models.fields.CharField: sharing>)
previous_version

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.

shared_with

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.

shared_with_team

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.