testing without ip field

This commit is contained in:
Parsa Nazer
2025-02-21 02:01:01 +03:30
parent 944158fa81
commit 4f0060f0ae
4 changed files with 29 additions and 6 deletions
+2 -2
View File
@@ -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