aschn / drf-tracking

Utils to track requests to Django Rest Framework API views
http://drf-tracking.readthedocs.org/
ISC License
366 stars 95 forks source link

requested_at and remote_addr fields in base_model are not null #141

Open niubencoolboy opened 5 years ago

niubencoolboy commented 5 years ago

In my case, when has IP white lists, the program can't get the remote_addr. But in the base_model, the field is setted to not null. remote_addr = models.GenericIPAddressField() the requested_at is the same. requested_at = models.DateTimeField(db_index=True)

niubencoolboy commented 5 years ago

So, I changed the two codes to blew: from django.utils.timezone import now

requested_at = models.DateTimeField(default=now, db_index=True)

remote_addr = models.GenericIPAddressField(null=True, blank=True)