This commit is contained in:
Rémi Oudin 2018-02-25 16:10:38 +01:00
parent 4b19febdf6
commit 0661fe0f01

View file

@ -6,13 +6,16 @@ the preferred search engin, and if the user is likely to directly use urls
or to type in the search engine.
"""
import os
import random
from django.db import models
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
NICKNAMES = open("/usr/share/dict/american-english").read().splitlines()
LASTNAMES = open("../data/lastnames.txt").read().splitlines()
FIRSTNAMES = open("../data/firstnames.txt").read().splitlines()
EMAIL_DOMAINS = open("../data/email_domains.txt").read().splitlines()
LASTNAMES = open(BASE_DIR + "/data/lastnames.txt").read().splitlines()
FIRSTNAMES = open(BASE_DIR + "/data/firstnames.txt").read().splitlines()
EMAIL_DOMAINS = open(BASE_DIR + "/data/email_domains.txt").read().splitlines()
class InvalidData(Exception):
@ -223,7 +226,7 @@ def create_profile(nick=None):
nick=nick,
first_name=first_name,
last_name=last_name,
email=email
email=email,
uses_url=(random.random() < 0.5),
)
profile.search_engine = random.choice(SearchEngine.objects.all())