Skip to content

Commit

Permalink
Make headshot backend configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
hancush committed Jul 8, 2024
1 parent b550d38 commit 43fb6e7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions councilmatic_core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
import opencivicdata.legislative.models
import opencivicdata.core.models


static_storage = FileSystemStorage(
location=os.path.join(settings.STATIC_ROOT), base_url="/"
)

MANUAL_HEADSHOTS = (
settings.MANUAL_HEADSHOTS if hasattr(settings, "MANUAL_HEADSHOTS") else {}
HEADSHOT_STORAGE_BACKEND = getattr(
settings, "COUNCILMATIC_HEADSHOT_STORAGE_BACKEND", static_storage
)


Expand Down Expand Up @@ -62,7 +61,7 @@ class Person(opencivicdata.core.models.Person):

headshot = models.FileField(
upload_to="images/headshots",
storage=static_storage,
storage=HEADSHOT_STORAGE_BACKEND,
default="images/headshot_placeholder.png",
)

Expand Down Expand Up @@ -352,7 +351,7 @@ class Meta:
null=True,
# Membership will just unlink if the post goes away
on_delete=models.SET_NULL,
help_text=" The Post held by the member in the Organization.",
help_text=" The Post held by the member in the Organization.",
)


Expand Down

0 comments on commit 43fb6e7

Please sign in to comment.