def get_absolute_url(self): return ( 'email:go', (), { 'pk_in_base62': base62.encode(self.pk, ), }, )
def uniq_hash(s): """ Create a short hash from a given string. Be warned, this function is a liar: it's not really a hash as it's CRC-based, and as such it has a high collision potential! """ if not isinstance(s, bytes): s = s.encode('utf-8') crc = crc32(s) return base62.encode(crc)
def url(self): current_site = Site.objects.get_current() return "http://{0}/{1}/".format(current_site.domain, base62.encode(self.pk))
def get_absolute_url(self): return ('email:go', (), {'pk_in_base62': base62.encode(self.pk, ), }, )
def mkrandstr(): return (base62.encode(int(time.time())) + base62.encode(random.randint(0, 61)))