Commit 4aef5b82 authored by ibuler's avatar ibuler

[Bugfix] export asset pof error when none of assets

parent 6903e05a
...@@ -198,9 +198,10 @@ class AssetDetailView(DetailView): ...@@ -198,9 +198,10 @@ class AssetDetailView(DetailView):
@method_decorator(csrf_exempt, name='dispatch') @method_decorator(csrf_exempt, name='dispatch')
class AssetExportView(View): class AssetExportView(View):
def get(self, request, *args, **kwargs): def get(self, request):
spm = request.GET.get('spm', '') spm = request.GET.get('spm', '')
assets_id = cache.get(spm, [Asset.objects.first().id]) assets_id_default = [Asset.objects.first().id] if Asset.objects.first() else [1]
assets_id = cache.get(spm, assets_id_default)
fields = [ fields = [
field for field in Asset._meta.fields field for field in Asset._meta.fields
if field.name not in [ if field.name not in [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment