Skip to content

Commit

Permalink
refactor: Remove cache for detail_company_id_user_id in update_compan…
Browse files Browse the repository at this point in the history
…y view

The cache for the detail_company_id_user_id key is now removed in the update_company view. This change ensures that the cache is cleared after updating a company, preventing any stale data from being displayed. It improves the accuracy and reliability of the application.
  • Loading branch information
QA2A committed Sep 5, 2024
1 parent f04e19e commit e16e12b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ def update_company(request, company_id):
company.save()

webhook_url = settings.SLACK_WEBHOOK_URL
# remove the cache for detail_company_id_user_id
cache_key = f'detail_{company_id}_user_{request.user.id}'
cache.delete(cache_key)

if webhook_url:
message = f"{company.name} updated:" + str(request.POST)
Expand Down

0 comments on commit e16e12b

Please sign in to comment.