Skip to content

Commit

Permalink
Merge pull request #1583 from fedspendingtransparency/fix/re-adding-d…
Browse files Browse the repository at this point in the history
…ata-dict-caching

Re-adding API caching to data_dictionary API and fixing ordering issue
  • Loading branch information
willkjackson authored Oct 10, 2018
2 parents 0419a12 + 68d2392 commit 0c8811c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def extract_data_from_source_file(path: str = None) -> dict:
else:
sections.append(section)

elements = {}
elements = OrderedDict()
for i, row in enumerate(sheet.values):
if i < 2:
continue
Expand Down
2 changes: 2 additions & 0 deletions usaspending_api/references/v2/views/data_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from rest_framework.response import Response

from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.exceptions import NoDataFoundException
from usaspending_api.common.views import APIDocumentationView
from usaspending_api.references.models import Rosetta
Expand All @@ -15,6 +16,7 @@ class DataDictionaryViewSet(APIDocumentationView):
endpoint_doc: /references/data_dictionary.md
"""

@cache_response()
def get(self, request, format=None):
try:
api_response = Rosetta.objects.filter(document_name="api_response").values("document")[0]
Expand Down

0 comments on commit 0c8811c

Please sign in to comment.