testing without ip field
This commit is contained in:
@@ -217,7 +217,7 @@ def get_location_from_ip(ip_address):
|
||||
return None
|
||||
|
||||
class SecurityBreachAttemptModel(models.Model):
|
||||
ip = models.CharField(max_length=100, verbose_name="آدرس آیپی")
|
||||
ip_address = models.CharField(max_length=100, verbose_name="آدرس آیپی")
|
||||
country = models.CharField(max_length=40, verbose_name="کشور", blank=True, null=True)
|
||||
region_name = models.CharField(max_length=40, verbose_name="منطقه", blank=True, null=True)
|
||||
city = models.CharField(max_length=40, verbose_name="شهر", blank=True, null=True)
|
||||
@@ -231,7 +231,7 @@ class SecurityBreachAttemptModel(models.Model):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.id:
|
||||
location_data = get_location_from_ip(self.ip)
|
||||
location_data = get_location_from_ip(self.ip_address)
|
||||
if location_data:
|
||||
self.country, self.region_name, self.city, self.zip_code, self.lat, self.lon, self.isp = location_data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user