[Bugfix] export asset pof error when none of assets

pull/756/head^2
ibuler 7 years ago
parent 6903e05af1
commit 4aef5b8229

@ -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 [

Loading…
Cancel
Save