I'm extending the user profile and added a last_ip field as shown below. How do I update this field whenever a user is logged in to its current IP? I am using allauth if it matters.
class UserProfile(models.Model):
user = models.OneToOneField(User)
last_ip = models.GenericIPAddressField(protocol='IPv4', verbose_name="Last Login IP")
location = models.CharField(max_length=50, blank=True)