Browse Source

fix a thing

main
xenua 2 years ago
parent
commit
e826a19565
Signed by: xenua
GPG Key ID: 8F93B68BD37255B8
  1. 6
      leftists/models.py

6
leftists/models.py

@ -37,9 +37,9 @@ class ShortLink(RandomSlugPKMixin, models.Model): @@ -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): @@ -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

Loading…
Cancel
Save