akvo.rsr.models.project_thumbnail module

class akvo.rsr.models.project_thumbnail.ProjectThumbnail(id, project, geometry, url, full_size_url)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

full_size_url

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

geometry

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

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>
project

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.

project_id
url

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

akvo.rsr.models.project_thumbnail.get_cached_thumbnail(project: Project, geometry: str, prefetched: bool = True, timeout: float = 0.5) ProjectThumbnail | None[source]

Gets a project’s thumbnail with the given geometry

The ProjectThumbnail table acts as a cache for the thumbnail URLs

so if the thumbnail with given geometry doesn’t exist, it’ll have to be generated.

Parameters:

prefetched – If the project was retrieved with QuerySet.prefetch_related If so, no DB query will be necessary should the thumbnail exist

akvo.rsr.models.project_thumbnail.validate_geometry_string(string: str)[source]