diff --git a/leftists/models.py b/leftists/models.py index 1037a00..35d94b6 100644 --- a/leftists/models.py +++ b/leftists/models.py @@ -37,9 +37,9 @@ class ShortLink(RandomSlugPKMixin, models.Model): return f"{self.domain.fqdn}/{self.location}" @classmethod - def get_from_request(cls, req): + def get_from_request(cls, req, loc): d = Domain.get_from_request(req) - return cls.objects.filter(domain=d).get(location=req.path[1:]) + return cls.objects.filter(domain=d).get(location=loc) @classmethod def hit(cls, req, loc): @@ -50,7 +50,7 @@ class ShortLink(RandomSlugPKMixin, models.Model): @classmethod def miss(cls, req, loc): - lnk = cls.get_from_request(req) + lnk = cls.get_from_request(req, loc) cls.cache[req.get_host()][loc] = lnk.to return lnk.to