1
Fork 0
e11sync/app/signup/models.py

22 lines
573 B
Python

from django.db import models
#from django.contrib.gis.geoip2 import GeoIP2
class Signup(models.Model):
email = models.EmailField()
created_at = models.DateTimeField(auto_now_add = True)
anonymized_ip = models.GenericIPAddressField()
user_agent = models.CharField(max_length = 255)
class Meta:
constraints = [
models.UniqueConstraint(name = "unique_email", fields = ["email"]),
]
def __str__(self):
return self.email
#def country(self):
# g = GeoIP2()
# return g.country(self.anonymized_ip)