photos package

Submodules

photos.admin module

class photos.admin.AlbumAdmin(model, admin_site)[source]

Bases: utils.translation.TranslatedModelAdmin

date_hierarchy = 'date'
exclude = None
fields = ('title_en', 'title_nl', 'slug', 'date', 'hidden', 'shareable', 'album_archive', '_cover')
form

alias of photos.forms.AlbumForm

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('title', 'date', 'num_photos', 'hidden', 'shareable')
list_filter = ('hidden', 'shareable')
property media
num_photos(obj)[source]

Pretty-print the number of photos

prepopulated_fields = {'slug': ('date', 'title_en')}
save_model(request, obj, form, change)[source]

Given a model instance save it to the database.

search_fields = ('title_en', 'title_nl', 'date')
class photos.admin.PhotoAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

exclude = ('_digest',)
list_display = ('__str__', 'album', 'hidden')
list_filter = ('album', 'hidden')
property media
save_model(request, obj, form, change)[source]

Given a model instance save it to the database.

search_fields = ('file',)

photos.apps module

class photos.apps.PhotosConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

name = 'photos'
ready()[source]

Override this method in subclasses to run code when Django starts.

verbose_name = 'Photos'

photos.forms module

class photos.forms.AlbumForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

exclude = ['dirname']
base_fields = {'album_archive': <django.forms.fields.FileField object>}
declared_fields = {'album_archive': <django.forms.fields.FileField object>}
property media

Return all media required to render the widgets on this form.

photos.models module

class photos.models.Album(id, dirname, date, slug, hidden, new_album_notification, _cover, shareable, title_en, title_nl)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property access_token
cover
date

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

dirname

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]
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)
hidden

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.

new_album_notification

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.

new_album_notification_id
objects = <django.db.models.manager.Manager object>
photo_set

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.

photosdir = 'photos'
photospath = '/__w/concrexit/concrexit/website/media/photos'
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.

shareable

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

slug

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

property title

Accessor that fetches the localized variant of title

title_en

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

title_nl

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

class photos.models.Photo(id, album, file, rotation, hidden, _digest)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

album

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.

album_id
covered_album

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 a ReverseOneToOneDescriptor instance.

file

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

get_rotation_display(*, field=<django.db.models.fields.IntegerField: rotation>)
hidden

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

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

photos.models.photo_uploadto(instance, filename)[source]

photos.services module

photos.services.check_shared_album_token(album, token)[source]
photos.services.extract_archive(request, album, archive)[source]
photos.services.extract_photo(request, archive_file, photo, album)[source]
photos.services.get_annotated_accessible_albums(request, albums)[source]
photos.services.is_album_accessible(request, album)[source]
photos.services.photo_determine_rotation(pil_image)[source]
photos.services.save_photo(photo_obj)[source]

photos.signals module

photos.signals.pre_photo_delete(sender, instance, **kwargs)[source]

Remove main photo file on deletion

photos.urls module

photos.validators module

class photos.validators.ArchiveFileTypeValidator(*args, **kwargs)[source]

Bases: object

deconstruct()

Return a 3-tuple of class import path, positional arguments, and keyword arguments.

message = 'Only zip and tar files are allowed.'
types = ['application/gzip', 'application/zip', 'application/x-gzip']

photos.views module

photos.views.album(request, slug)[source]
photos.views.album_download(request, slug)[source]
photos.views.download(request, slug, filename)[source]
photos.views.index(request)[source]
photos.views.shared_album(request, slug, token)[source]
photos.views.shared_album_download(request, slug, token)[source]
photos.views.shared_download(request, slug, token, filename)[source]