2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Setting caching (#3178)

* Revert "Remove stat context variables"

This reverts commit 0989c308d0.

* Add a caching framework for inventree settings

- Actions that use "settings" require a DB hit every time
- For example the part.full_name() method looks at the PART_NAME_FORMAT setting
- This means 1 DB hit for every part which is serialized!!

* Fixes for DebugToolbar integration

- Requires different INTERNAL_IPS when running behind docker
- Some issues with TEMPLATES framework

* Revert "Revert "Remove stat context variables""

This reverts commit 52e6359265.

* Add unit tests for settings caching

* Update existing unit tests to handle cache framework

* Fix for unit test

* Re-enable cache for default part values

* Clear cache for further unit tests
This commit is contained in:
Oliver
2022-06-12 10:56:16 +10:00
committed by GitHub
parent 90aa7b8444
commit 6eddcd3c23
9 changed files with 164 additions and 31 deletions

View File

@ -204,7 +204,7 @@ class BuildReportTest(ReportTest):
self.assertEqual(headers['Content-Disposition'], 'attachment; filename="report.pdf"')
# Now, set the download type to be "inline"
inline = InvenTreeUserSetting.get_setting_object('REPORT_INLINE', self.user)
inline = InvenTreeUserSetting.get_setting_object('REPORT_INLINE', user=self.user)
inline.value = True
inline.save()