Re: Current user ip address on form.py

2018-04-27 Thread Andréas Kühne
If you want the request in a form, you need to supply it. You can use the code you posted - but then when you create the form - you need to add the request. Something like: form = Form(request=request) every time you init the form - then it will work for you. Regards, Andréas 2018-04-27 16:0

Re: Current user ip address on form.py

2018-04-27 Thread James Farris
This should work https://github.com/un33k/django-ipware/blob/master/README.md On Fri, Apr 27, 2018 at 5:45 AM lakshitha kumara wrote: > Hello Andréas > > Thank for your reply. but unfortunately i need get user ip on form.py or > custom py file in django. is there way to to that ? > > Some one

Re: Current user ip address on form.py

2018-04-27 Thread lakshitha kumara
Hello Andréas Thank for your reply. but unfortunately i need get user ip on form.py or custom py file in django. is there way to to that ? Some one post on this example can be work but its also doesn't work class RegistrationForm(UserCreationForm): def __init__(self, *args, **kwargs):

Re: Current user ip address on form.py

2018-04-27 Thread Andréas Kühne
Hi, You can get the IP address from the request. See here: https://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django Regards, Andréas 2018-04-27 14:28 GMT+02:00 lakshitha kumara : > Hello Guys > > Is there way to get current user ip address on form.py > > Thanks > > --