read file name
This commit is contained in:
parent
8488449cca
commit
cbad99e3ac
|
|
@ -741,6 +741,8 @@ class MenuFilesSerializers(ProjectModelSerializer):
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
extension = attrs['file'].name.split('.')[-1]
|
extension = attrs['file'].name.split('.')[-1]
|
||||||
attrs['type'] = 'image' if extension in ('jpg', 'jpeg', 'png') else 'file'
|
attrs['type'] = 'image' if extension in ('jpg', 'jpeg', 'png') else 'file'
|
||||||
|
if not attrs['name']:
|
||||||
|
attrs['mame'] = attrs['file'].name
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user