Answer the question
In order to leave comments, you need to log in
How to save user's ip when registering in django?
How to make models and views right
Answer the question
In order to leave comments, you need to log in
The first link on google answers your question.
The web server usually passes information about the client's IP in the REMOTE_ADDR variable, and if there is a proxy server in front, then in HTTP_X_FORWARDED_FOR. It remains only to read the variable. There are already ready-made solutions here: https://stackoverflow.com/questions/4581789
In models, you are already looking at your implementation. I think it will be enough to simply add a new field that will store the received IP.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question