akvo.rsr.models.partner_site module

Akvo RSR is covered by the GNU Affero General Public License.

See more details in the license.txt file located at the root folder of the Akvo RSR module. For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.

class akvo.rsr.models.partner_site.PartnerSite(*args, **kwargs)[source]

Bases: TimestampsMixin

Model makes it possible to cater different data sets based on request’s hostname.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

about_box

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

about_image

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

all_maps

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

all_projects()[source]

All projects of the Page

apply_keywords(projects)[source]

Apply keywords to the Page’s projects.

cname

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

created_at

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

custom_css

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

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)

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

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

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

custom_return_url_text

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

default_language

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

enabled

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

exclude_keywords

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

facebook_app_id

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

facebook_button

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

property favicon

Return favicon.

property full_domain

Return full domain.

get_absolute_url()[source]

Return absolute url.

get_default_language_display(*, field=<akvo.rsr.fields.ValidXMLCharField: default_language>)
google_translation

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

hostname

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.

is_cname_request(netloc)[source]
keywords

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.

last_modified_at

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

Return logo.

property map_marker

Return full path to map marker if it exists.

notes

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

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.

organisation_id
partner_projects

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

partners()[source]

All partner organisations of all projects of the Page

password

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

piwik_id

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

program

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.

program_id
projects()[source]

Publicly published projects of the page.

redirect_cname

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

property return_url

Return custom url or /.

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.

show_keyword_logos

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

show_keywords()[source]

Return keywords for PartnerSite.

property show_private_projects

Show private projects if a password has been set.

property stylesheet

Return stylesheet.

tagline

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

twitter_button

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

ui_translation

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

updates()[source]

All updates of all projects of the Page

classmethod yank_hostname(netloc)[source]

Get <partner1> from <partner1.akvoapp.org>.

From a netloc return what is stored as “hostname” on the PartnerSite model.

akvo.rsr.models.partner_site.about_image_path(instance, file_name)[source]

Return absolute image path.

akvo.rsr.models.partner_site.custom_css_path(instance, filename)[source]

Return custom css path.

akvo.rsr.models.partner_site.custom_favicon_path(instance, filename)[source]

Return custom favicon path.

akvo.rsr.models.partner_site.custom_logo_path(instance, filename)[source]

Return custom logo path.

akvo.rsr.models.partner_site.custom_map_marker_path(instance, filename)[source]

Return custom map marker path.