I would like to create a field in a form that can automatically insert the IP address of the PC that use the application. Is it possible?
1 Like
You can add it before saving.
def before_insert(self):
self.user_ip = frappe.get_request_header('REMOTE_ADDR')
1 Like
I am unable to get the IP address using frappe.get_request_header(‘REMOTE_ADDR’).
My version is 4.25.7. Does it matter? Or am I missing something in my server?
Version 4 may have a different API, just grep REMOTE_ADDR to get a clue.
I did that but didn’t see any difference. And also I realised that the user last login IP (that uses the same way) is not captured as well.