def create_log(self, request):
        if request.user and request.session and request.session.session_key:
            stamp = timezone.now()
            url = request.get_full_path()
            if _is_ignorable_404(url):
                return None
            # Truncate in case it doesn't fit
            url = url[:self.model._meta.get_field_by_name('url')[0].max_length]
            log = self.model(user=request.user,
                             session=request.session.session_key,
                             url=url,
                             stamp=stamp)
            log.save()
            return log
        else:
            return None
dataset/ETHPy150Open orcasgit/django-request-log/log/models.py/RequestLogManager.create_log/original