示例#1
0
 def author(self):
     if self.pub_author not in (None,):
         try:
             return User.objects.get(username__iexact=self.pub_author)
         except Exception:
             return None
     random.seed(generator.gen_seed())
     l = User.objects.all().count()
     i = random.randrange(0, l)
     return User.objects.all()[i]
示例#2
0
 def username(self):
     random.seed(generator.gen_seed())
     return slugify(self.first_name + '_' + '%d' % random.randrange(1000, 9999))