Merge pull request #382 from ThomasWaldmann/init-timestamps

new host creation: set update timestamps to current time, fixes #357
This commit is contained in:
TW 2018-10-19 20:06:56 +02:00 committed by GitHub
commit 667d4a4a29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -244,6 +244,9 @@ class AddHostView(CreateView):
success, level, msg = False, messages.ERROR, 'Communication to name server failed [%s]' % str(err) success, level, msg = False, messages.ERROR, 'Communication to name server failed [%s]' % str(err)
else: else:
self.object.created_by = self.request.user self.object.created_by = self.request.user
dt_now = now()
self.object.last_update_ipv4 = dt_now
self.object.last_update_ipv6 = dt_now
self.object.save() self.object.save()
success, level, msg = True, messages.SUCCESS, 'Host added.' success, level, msg = True, messages.SUCCESS, 'Host added.'
messages.add_message(self.request, level, msg) messages.add_message(self.request, level, msg)