Skip to content

Commit

Permalink
Fix site title and keywords never get updated (#2900)
Browse files Browse the repository at this point in the history
  • Loading branch information
tboye authored Oct 11, 2023
1 parent a66eaae commit 2416a3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Topics creation, update and deletion are now opened to all users [#2898](https://github.com/opendatateam/udata/pull/2898)
- Topics are now `db.Owned` and searchable by `id` in dataset search [#2901](https://github.com/opendatateam/udata/pull/2901)
- Remove `deleted` api field that does not exist [#2903](https://github.com/opendatateam/udata/pull/2903)
- Fix site title and keywords never get updated [#2900](https://github.com/opendatateam/udata/pull/2900)

## 6.1.7 (2023-09-01)

Expand Down
11 changes: 9 additions & 2 deletions udata/core/site/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,17 @@ def count_max_org_datasets(self):
def get_current_site():
if getattr(g, 'site', None) is None:
site_id = current_app.config['SITE_ID']
site_title = current_app.config.get('SITE_TITLE')
site_keywords = current_app.config.get('SITE_KEYWORDS', [])
g.site, _ = Site.objects.get_or_create(id=site_id, defaults={
'title': current_app.config.get('SITE_TITLE'),
'keywords': current_app.config.get('SITE_KEYWORDS', []),
'title': site_title,
'keywords': site_keywords,
})
if g.site.title != site_title:
Site.objects(id=site_id).modify(set__title=site_title)
if g.site.keywords != site_keywords:
Site.objects(id=site_id).modify(set__keywords=site_keywords)

return g.site


Expand Down

0 comments on commit 2416a3e

Please sign in to comment.