Skip to content

Commit

Permalink
Merge pull request #292 from datamade/hcg/configurable-headshot-backend
Browse files Browse the repository at this point in the history
Make headshot backend configurable
  • Loading branch information
hancush authored Jul 15, 2024
2 parents b550d38 + 0b91792 commit c68962a
Show file tree
Hide file tree
Showing 10 changed files with 19,585 additions and 18,902 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:

# Black config (Python formatter)
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.4.2
hooks:
- id: black
exclude: ^(councilmatic_core/migrations/)
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The django-councilmatic app provides the core functionality for the `Councilmati

Requirements
------------
- Python >= 3.6
- Python >= 3.8

Features
--------
Expand Down
8 changes: 8 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release notes for django-councilmatic

## Version 3.3

_Changes_

Allows storage backend for Person headshots to be configured via `COUNCILMATIC_HEADSHOT_STORAGE_BACKEND` setting.

**Release date:** 07-15-2024

## Version 3.2

_Changes_
Expand Down
3 changes: 1 addition & 2 deletions councilmatic_core/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class EventsFeed(Feed):

title = settings.CITY_COUNCIL_NAME + " " + "Recent Events"
link = reverse_lazy("events")
description = "Recently announced events."

def item_link(self, event):
# return the Councilmatic URL for the event
Expand All @@ -272,7 +271,7 @@ def item_pubdate(self, event):
return event.start_time

def description(self, obj):
return "Events"
return "Recently Announced Events"

def items(self, obj):
return Event.objects.all()[: self.NUM_RECENT_EVENTS]
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
15 changes: 8 additions & 7 deletions councilmatic_core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,14 @@ def get_context_data(self, **kwargs):
seo.update(settings.SITE_META)
if person.current_council_seat:
short_name = re.sub(r",.*", "", person.name)
seo[
"site_desc"
] = "%s - %s representative in %s. See what %s has been up to!" % (
person.name,
person.current_council_seat,
settings.CITY_COUNCIL_NAME,
short_name,
seo["site_desc"] = (
"%s - %s representative in %s. See what %s has been up to!"
% (
person.name,
person.current_council_seat,
settings.CITY_COUNCIL_NAME,
short_name,
)
)
else:
seo["site_desc"] = "Details on %s, %s" % (
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ DJANGO_SETTINGS_MODULE = tests.test_config
django_find_project = false
testpaths = tests
addopts = -sxv
pythonpath = .
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
setup(
name="django-councilmatic",
python_requires=">=3.6",
version="3.2",
version="3.3",
packages=find_packages(exclude=("tests",)),
include_package_data=True,
license="MIT License", # example license
Expand Down
Loading

0 comments on commit c68962a

Please sign in to comment.