Changeset View
Changeset View
Standalone View
Standalone View
films/models/production_logs.py
| from datetime import date, timedelta | from datetime import date, timedelta | ||||
| from django.contrib.auth.models import User | from django.contrib.auth.models import User | ||||
| from django.db import models | from django.db import models | ||||
| from django.urls.base import reverse | from django.urls.base import reverse | ||||
| from common import mixins | from common import mixins | ||||
| from common.upload_paths import get_upload_to_hashed_path | from common.upload_paths import get_upload_to_hashed_path | ||||
| from films.models import Asset, Film, FilmCrew | from films.models import Asset, Film, FilmCrew | ||||
| from static_assets.models import StorageLocation | |||||
| class ProductionLog(mixins.CreatedUpdatedMixin, models.Model): | class ProductionLog(mixins.CreatedUpdatedMixin, models.Model): | ||||
| """A log (collection) of all authors' production log entries in one week.""" | """A log (collection) of all authors' production log entries in one week.""" | ||||
| class Meta: | class Meta: | ||||
| verbose_name = 'production weekly' | verbose_name = 'production weekly' | ||||
| verbose_name_plural = 'production weeklies' | verbose_name_plural = 'production weeklies' | ||||
| Show All 21 Lines | author = models.ForeignKey( | ||||
| null=True, | null=True, | ||||
| on_delete=models.PROTECT, | on_delete=models.PROTECT, | ||||
| related_name='authored_production_logs', | related_name='authored_production_logs', | ||||
| verbose_name='author (optional)', | verbose_name='author (optional)', | ||||
| help_text='The actual author of the summary in the weekly production log', | help_text='The actual author of the summary in the weekly production log', | ||||
| ) | ) | ||||
| author.description = 'The actual author of the summary in the weekly production log.' | author.description = 'The actual author of the summary in the weekly production log.' | ||||
| youtube_link = models.URLField(blank=True) | youtube_link = models.URLField(blank=True) | ||||
| storage_location = models.ForeignKey( | |||||
| StorageLocation, on_delete=models.PROTECT, related_name='production_logs', editable=False, | |||||
| ) | |||||
| thumbnail = models.FileField(upload_to=get_upload_to_hashed_path) | thumbnail = models.FileField(upload_to=get_upload_to_hashed_path) | ||||
| @property | @property | ||||
| def author_name(self) -> str: | def author_name(self) -> str: | ||||
| """Get the production log summary's author full name. | """Get the production log summary's author full name. | ||||
| Usually the author of the log will be the same as the user who uploads it.""" | Usually the author of the log will be the same as the user who uploads it.""" | ||||
| if self.author: | if self.author: | ||||
| ▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines | |||||