diff --git a/profiles/models.py b/profiles/models.py index deb7e7b..7c120e7 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -204,3 +204,27 @@ class Profile(models.Model): on_delete=models.CASCADE) browser_fingerprint = models.ForeignKey(BrowserFingerprint, on_delete=models.CASCADE) + + +def generate_email(nick, first_name, last_name): + domain = random.choice(EMAIL_DOMAINS) + if random.random() < 0.3: + email = first_name + "." + last_name + "@" + domain + else: + email = nick + "@" + domain + return email + +def create_profile(nick=None): + nick = "".join(random.sample(NICKNAMES, random.randrange(2,5))) + first_name = random.choice(FIRSTNAMES) + last_name = random.choice(LASTNAMES) + email = generate_email(nick, first_name, last_name) + profile = Profile( + nick=nick, + first_name=first_name, + last_name=last_name, + email=email + uses_url=(random.random() < 0.5), + ) + profile.search_engine = random.choice(SearchEngine.objects.all()) + profile.browser_fingerprint = random.choice(BrowserFingerprint.objects.all())