fix: mlog create 不带mtask时报错
This commit is contained in:
parent
c376cfb24a
commit
27e4022d9a
|
|
@ -122,7 +122,8 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
return super().update(instance, validated_data)
|
return super().update(instance, validated_data)
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
mtask = attrs['mtask']
|
mtask = attrs.get('mtask', None)
|
||||||
|
if mtask:
|
||||||
handle_date = attrs['handle_date']
|
handle_date = attrs['handle_date']
|
||||||
if handle_date >= mtask.start_date and handle_date <= mtask.end_date:
|
if handle_date >= mtask.start_date and handle_date <= mtask.end_date:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue