Skip to content

Commit

Permalink
Bugfix - not importing recording title, version title, etc. Blacked.
Browse files Browse the repository at this point in the history
  • Loading branch information
matijakolaric committed Dec 9, 2024
1 parent ec19e86 commit 5d898b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions music_publisher/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,12 @@ class BackupViewSet(viewsets.ViewSet):
permission_classes = [IsSuperuser]
renderer_classes = [renderers.JSONRenderer]

# def list(self, request, *args, **kwargs):
# d = {}
# d.update(Work.objects.get_dict(Work.objects.all()))
# d.update(CommercialRelease.objects.get_dict(Release.objects.all()))
# return Response(d)

def json(self, request, *args, **kwargs):
yield """{"works":["""
renderer = JSONRenderer()
for i, work_item in enumerate(Work.objects.get_dict_items(Work.objects.all())):
for i, work_item in enumerate(
Work.objects.get_dict_items(Work.objects.all())
):
if i > 0:
yield ","
yield renderer.render(work_item)
Expand All @@ -327,7 +323,11 @@ def json(self, request, *args, **kwargs):
yield renderer.render(release.get_dict(with_tracks=True))
yield """]}"""

def list(self,request, *args, **kwargs):
response = StreamingHttpResponse(self.json(request, *args, **kwargs),status=200, content_type='application/json')
response['Cache-Control']= 'no-cache',
def list(self, request, *args, **kwargs):
response = StreamingHttpResponse(
self.json(request, *args, **kwargs),
status=200,
content_type="application/json",
)
response["Cache-Control"] = ("no-cache",)
return response
1 change: 1 addition & 0 deletions music_publisher/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ def get_dict(self, qs):
"works": works,
}


class Work(TitleBase):
"""Concrete class, with references to foreign objects.
Expand Down

0 comments on commit 5d898b7

Please sign in to comment.