Browse Source

[Bugfix] export asset pof error when none of assets

pull/756/head^2
ibuler 7 years ago
parent
commit
4aef5b8229
  1. 5
      apps/assets/views/asset.py

5
apps/assets/views/asset.py

@ -198,9 +198,10 @@ class AssetDetailView(DetailView):
@method_decorator(csrf_exempt, name='dispatch')
class AssetExportView(View):
def get(self, request, *args, **kwargs):
def get(self, request):
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 = [
field for field in Asset._meta.fields
if field.name not in [

Loading…
Cancel
Save