示例#1
0
 def get_absolute_url(self):
     return (
         'email:go',
         (),
         {
             'pk_in_base62': base62.encode(self.pk, ),
         },
     )
示例#2
0
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)
示例#3
0
 def url(self):
     current_site = Site.objects.get_current()
     return "http://{0}/{1}/".format(current_site.domain, base62.encode(self.pk))
示例#4
0
文件: models.py 项目: AlexStarov/Shop
 def get_absolute_url(self):
     return ('email:go',
             (),
             {'pk_in_base62': base62.encode(self.pk, ), }, )
示例#5
0
 def url(self):
     current_site = Site.objects.get_current()
     return "http://{0}/{1}/".format(current_site.domain,
                                     base62.encode(self.pk))
示例#6
0
def mkrandstr():
    return (base62.encode(int(time.time())) +
            base62.encode(random.randint(0, 61)))