photos package¶
Submodules¶
photos.admin module¶
-
class
photos.admin.
AlbumAdmin
(model, admin_site)[source]¶ Bases:
utils.translation.TranslatedModelAdmin
Model for Album admin page.
-
date_hierarchy
= 'date'¶
-
exclude
= None¶
-
fields
= ('title_en', 'slug', 'date', 'hidden', 'shareable', 'album_archive', '_cover')¶
-
form
¶ alias of
photos.forms.AlbumForm
-
list_display
= ('title', 'date', 'num_photos', 'hidden', 'shareable')¶
-
list_filter
= ('hidden', 'shareable')¶
-
property
media
¶
-
prepopulated_fields
= {'slug': ('date', 'title_en')}¶
-
search_fields
= ('title_en', 'date')¶
-
photos.apps module¶
photos.forms module¶
-
class
photos.forms.
AlbumForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
Class for an album submission form.
-
class
Meta
[source]¶ Bases:
object
Meta class for AlbumForm.
-
fields
= ('title_en', 'date', 'slug', 'hidden', 'new_album_notification', 'shareable', '_cover')¶
-
model
¶ alias of
photos.models.Album
-
-
base_fields
= {'_cover': <django.forms.models.ModelChoiceField object>, 'album_archive': <django.forms.fields.FileField object>, 'date': <django.forms.fields.DateField object>, 'hidden': <django.forms.fields.BooleanField object>, 'new_album_notification': <django.forms.models.ModelChoiceField object>, 'shareable': <django.forms.fields.BooleanField object>, 'slug': <django.forms.fields.SlugField object>, 'title_en': <django.forms.fields.CharField object>}¶
-
declared_fields
= {'album_archive': <django.forms.fields.FileField object>}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
photos.models module¶
-
class
photos.models.
Album
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Model for Album objects.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
property
access_token
¶ Return access token for album.
-
cover
¶ Return cover of Album.
If a cover is not set, return a random photo or None if there are no photos.
-
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_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)¶
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 aForwardManyToOneDescriptor
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 aReverseManyToOneDescriptor
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'¶
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.
-
exception
-
class
photos.models.
Photo
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Model for a Photo object.
-
exception
DoesNotExist
¶
-
exception
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 aForwardManyToOneDescriptor
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 aReverseOneToOneDescriptor
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>)¶
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.
-
exception
photos.services module¶
Return a 404 if the token does not match the album token.
-
photos.services.
extract_photo
(request, archive_file, photo, album)[source]¶ Extract ZipInfo or TarInfo Photo object.
-
photos.services.
get_annotated_accessible_albums
(request, albums)[source]¶ Annotate the albums which are accessible by the user.
photos.signals module¶
photos.urls module¶
photos.validators module¶
-
class
photos.validators.
ArchiveFileTypeValidator
(*args, **kwargs)[source]¶ Bases:
object
Validator class for archive files.
-
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']¶
-