Skip to content

Commit

Permalink
contract form update ing
Browse files Browse the repository at this point in the history
  • Loading branch information
nc2U committed May 12, 2024
1 parent d7bd4ef commit 05c8630
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
21 changes: 10 additions & 11 deletions app/django/apiV1/serializers/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,17 +413,16 @@ def update(self, instance, validated_data):
cont_file = ContractFile(contract=instance, file=new_file, user=user)
cont_file.save()

# edit_file = self.initial_data.get('editFile', None) # pk
# cng_file = self.initial_data.get('cngFile', None) # change file
#
# if edit_file:
# file = ContractFile.objects.get(pk=edit_file)
# if cng_file:
# old_file = file.file
# if os.path.isfile(old_file.path):
# os.remove(old_file.path)
# file.file = cng_file
# file.save()
edit_file = self.initial_data.get('editFile', None) # pk
cng_file = self.initial_data.get('cngFile', None) # change file

if edit_file and cng_file:
update_file = ContractFile.objects.get(pk=edit_file)
old_file = update_file.file
if os.path.isfile(old_file.path):
os.remove(old_file.path)
update_file.file = cng_file
update_file.save()

del_file = self.initial_data.get('delFile', None)
if del_file:
Expand Down
1 change: 0 additions & 1 deletion app/vue/src/views/contracts/Register/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ const typeSelect = (payload: {
}
const onSubmit = (payload: Contract & { status: '1' | '2' }) => {
console.log(payload)
const { pk, ...getData } = payload as { [key: string]: any }
if (project.value) getData.project = project.value
Expand Down

0 comments on commit 05c8630

Please sign in to comment.