コード例 #1
0
ファイル: fillDB.py プロジェクト: YIShikunov/tp-web
def generateAnswers(n):
    for i in range(n):
        start = [
            "Do ", "Get ", "Leave ", "Remove ", "Press ", "Don't ", "Use ",
            "EXTERMINATE!!!! ", "Kill ", "Banish ", "Love ", "Hug ",
            "Complete ", "Do ", "Make ", "Enjoy ", "Start ", "Delete ",
            "Keep Calm "
        ]
        mid = [
            "a barrel roll", "your mom", "the configs", "the Force",
            "the attack", "that RED button", "your wits", "WD-40", "duct tape",
            "card", "EXTERMINATE!!! ", "some noise", "the show", "and go on"
        ]
        end = [
            ", Luke.", ", noob!", ", man!", " or you're screwed.", "!",
            "br@h!", "EXTERMINATE?!"
        ] + [".", "?", "!"] * 2
        ansText = random.choice(start) + random.choice(mid) + random.choice(
            end) + '(' + str(random.randint(1, 1000000)) + ')'
        author = UserAccount.objects.all().order_by('?')[0]
        approved = random.choice([True] + 5 * [False])
        question = Question.objects.all().order_by('?')[0]
        ans = Answer(content=ansText,
                     author=author,
                     approved=approved,
                     question=question)
        ans.save()
        if i % 500 == 0:
            print i
コード例 #2
0
    def handle(self, *args, **options):
        fake = Factory.create()

        min_number = int(options['min_number'])
        max_number = int(options['max_number'])

        users = User.objects.all()[1:]
        questions = Question.objects.all()
        is_correct = (True, False)
        counter = 1
        for q in questions:
            for i in range(0, randint(min_number, max_number)):
                ans = Answer()

                ans.text = fake.paragraph(nb_sentences=randint(2, 4),
                                          variable_nb_sentences=True)
                ans.user = choice(users)
                ans.question = q
                ans.rating = randint(0, 1500)
                ans.is_correct = choice(is_correct)
                ans.id = counter
                counter += 1
                ans.save()
                self.stdout.write('in question [%d] add ans [%d]' %
                                  (q.id, ans.id))
コード例 #3
0
    def fill_db(self):
        for i in range(0, 30):
            usr = User(username='******' + str(i),
                       password='******' + str(i),
                       first_name='User')
            usr.save()
            prof = Profile(avatar='avatar.jpeg', user=usr)
            prof.save()
            try:
                tbag = Tag.objects.get(name='Bucket' + str(i % 20))
                tbag.popularity += 1
            except Exception:
                tbag = Tag(name='Bucket' + str(i % 20), popularity=1)
            tbag.save()

            quest = Question(title=str(i) + 'bucket',
                             text='see my bucket, I have a' + str(10000 - i) +
                             ' bucket remains',
                             author=prof,
                             votes=i)
            quest.save()
            quest.liked.add(prof)
            quest.tag.add(tbag)

            for j in range(0, 20):
                ans = Answer(text='Test answer' + str(i),
                             author=prof,
                             question=quest)
                ans.votes = int(((i + j) * 6) % 40)
                ans.save()
                ans.voted.add(prof)
コード例 #4
0
ファイル: fill.py プロジェクト: sng1996/DjangoProject
	def handle(self, *args, **options):
		user = User.objects.get(email='*****@*****.**')
		list_tags = ["Perl", "Python", "TechnoPark", "MySQL", "Django", "Mailru", "Voloshin", "Firefox", "black-jack", "bender"]
		Question.objects.all().delete()
		Answer.objects.all().delete()
		Tag.objects.all().delete()
		for i in range(0, 100):
			q=Question(
				author=user,
				body='body ' + str(i),
				title = 'title ' + str(i),
			)
			q.save()
			for j in range(1, 3):
				a=Answer(
					text='answer ' + str(i) + ' ' + str(j),
					author=user,
					question=q,
				)
				a.save()
			tmp = i%10
			t=Tag(
				name = list_tags[tmp],
				rating = tmp,
			)
			t.save()
			t.question.add(q)
コード例 #5
0
ファイル: views.py プロジェクト: minaevmike/asktp
def ans(request):
	errors =[]
	if not request.user.is_authenticated():
		errors.append("You need to login")
		return erquestion(request, errors)
	else:
		try:
			q_id = request.GET['id']
			if request.method == 'POST':
				form = AnswerForm(request.POST)
				if form.is_valid():
					cd = form.cleaned_data
					u = request.user
					q = Question.objects.get(id = q_id)
					a = Answer(author = u, question = q, answer_date = timezone.now(), content = cd['content'], isright = False, rating = 0)
					a.save()
					body = cd['content']
					send_email('%s answer to your question, %s' % (u.username , q.user.username),  body, [q.user.email])
					return HttpResponseRedirect("/answers/?id=" + str(q_id))
		except Question.DoesNotExist:
			errors.append("Wrong id")
			return erquestion(request, errors)
		except KeyError:
			errors.append("No id field in get request")
			return erquestion(request, errors)
		except:
			errors.append("Something goes wrong")
			return erquestion(request, errors)
	return HttpResponseRedirect("/answers/?id=" + str(q_id))
コード例 #6
0
def create_answers(users, questions):
  for i in range(0, 1000000):
    uid = random.randint(0, len(users) - 1)
    qid = random.randint(0, len(questions) - 1)
    
    answer = Answer(contents="Просто ответ :|", question=questions[qid], author=users[uid], date_created=timezone.now())
    answer.save()
コード例 #7
0
ファイル: views.py プロジェクト: ArturAmbartsumov/TP_web
def add_answer(request):
    q = get_object_or_404(Question, pk=2)
    u = get_object_or_404(User, pk=12)
    for i in range(5000, 10000):
        answer = Answer(ansver_text=int(i), customuser=u.customuser, question=q, pub_data=timezone.now(), flag=0)
        answer.save()
    return HttpResponseRedirect(reverse("questions"))
コード例 #8
0
ファイル: views.py プロジェクト: OlegElizarov/TPark_WEB
def question(request, question_id):
    if request.method == "GET":
        q = get_object_or_404(Question, pk=question_id)
        a = q.answer_set.all()
        answer_list = paginator(request, a, 2)
        form = answerform()
        return render(
            request, 'ask/question.html', {
                'question': q,
                'answer_list': answer_list,
                'tags': Tag.objects.besters(),
                'question_list': answer_list,
                'users': Author.objects.all(),
                'form': form,
            })
    if request.method == "POST":
        q = get_object_or_404(Question, pk=question_id)
        form = answerform(request.POST)
        if form.is_valid():
            a = Answer(question=q,
                       text=form.cleaned_data['text'],
                       title=form.cleaned_data['title'],
                       author=request.user.author,
                       correct=False,
                       pub_date=timezone.now())
            a.save()
            return HttpResponseRedirect(
                reverse('ask:question', kwargs={'question_id': question_id}))
コード例 #9
0
    def handle(self, *args, **options):
		u = User.objects.get(id=1)
		q = Question.objects.get(id=8)
		a = Answer(question = q,
				   text = u'Новый ответ!)!)',
				   author = u,
				   )
		a.save()
コード例 #10
0
ファイル: fake_answer.py プロジェクト: tohasvs/Sky-Ask-Site
	def handle(self, *args, **options):
		n = int(args[0])
		qn = Question.objects.count()
		qu = User.objects.count()
		for i in range(1, n):
			user = User.objects.get(id = random.randint(1, qu))
			try:
				a = Answer(content = self.fake.text(random.randint(50, 400)), qst = Question.objects.get(id = random.randint(1, qn)), 
									user = user, date = self.fake.date(user.reg_date.month, user.reg_date.year), flag = False, raiting=0)
				a.save()
			except Question.DoesNotExist:
				print("Question does not exist")
コード例 #11
0
 def _fill_answer(self):
     print('FILLING ANSWER MODEL...')
     for ix in range(500):
         temp_answer = Answer(question=np.random.choice(
             Question.objects.all()),
                              text='Answer{}'.format(ix),
                              rating=np.random.normal(scale=20),
                              creation_date=timezone.now(),
                              edit_date=timezone.now(),
                              is_correct=False)
         temp_answer.save()
     print('ADDED {} ANSWERS'.format(Answer.objects.count()))
コード例 #12
0
ファイル: addanswer.py プロジェクト: 777AvEnGeR777/webproject
    def handle(self, *args, **options):
        text = options['text']

        try:
            question = Question.objects.get(pk=options['q_id'])
        except Question.DoesNotExist:
            raise CommandError("Question %d doesn't exist" % options['q_id'])

        try:
            user = Profile.objects.get(user_id=options['author_id'])
        except Profile.DoesNotExist:
            raise CommandError("User %d doesn't exist" % options['author_id'])

        answer = Answer(text=text, author=user, question=question)
        answer.save()
コード例 #13
0
def answer(request):
    if (request.method == "POST"):
        form = NewAnswerForm(request.POST)
        if (form.is_valid):
            uscontent = request.POST["content"]
            ususer = User.objects.get(username=request.user.username)
            usquestionID = int(request.POST["question"])
            usquestion = Question.objects.get(id=usquestionID)
            answ = Answer(content=uscontent,
                          question=usquestion,
                          author=ususer)
            answ.save()
            return questionID(request, usquestionID)
    else:
        return redirect('/question')
コード例 #14
0
def detail(request,question_id):
    if request.method == "POST":
        if not request.user.is_authenticated:
            return redirect('askCommunity:login')
        question = Question.objects.get(question_id = question_id)
        answer = Answer()
        answer.question_id = question
        answer.answer = request.POST.get('answer')
        answer.answered_by = Profile.objects.get(user = request.user)
        answer.save()
    else:
        question = Question.objects.get(question_id = question_id)
    all_answers = Answer.objects.filter(question_id = question_id)
    context = {'question' : question,
    'answers' : all_answers}
    return render(request,'detail.html',context = context)
コード例 #15
0
def ajaxAnswer(request):
    if request.is_ajax():
        dataJSON = simplejson.loads(request.raw_post_data)
        textData = dataJSON["text"]
        userData = User.objects.get(id=dataJSON["author"])
        questionData = Question.objects.get(id=dataJSON["question"])
        answ = Answer(content=textData, question=questionData, author=userData)
        answ.save()
        notif = Notifications(user=questionData.author,
                              answer=answ,
                              answer_comment=False)
        notif.save()
        mailNotify(notif)
        return HttpResponse("success")
    else:
        redirect('/question')
コード例 #16
0
ファイル: add_answers.py プロジェクト: SiiTP/ask_Semenchenko
    def handle(self, *args, **options):
        (amount,) = args
        count = int(amount)
        countOfQuestions = Question.objects.count()
        #EXCEPTIONS
        if count < 1:
            raise ValueError('incorrect parameter')
        if countOfQuestions == 0:
            raise ValueError('table of questions is empty. You must add questions!')

        firstQuestionID = Question.objects.first().id
        lastQuestionID = Question.objects.last().id
        firstUserID = User.objects.first().id
        lastUserID = User.objects.last().id
        createdAnswers=0
        #generate answers
        for i in range(count):
            while True:
                try:
                    q = Question.objects.get(id=random.randint(firstQuestionID , lastQuestionID))
                    break
                except ObjectDoesNotExist:
                    continue

            while True:
                try:
                    u = User.objects.get(id=random.randint(firstUserID + 1, lastUserID)) #without admin user
                    break
                except ObjectDoesNotExist:
                    continue

            a_text = randomText(random.randint(3,30))
            answ = Answer(question = q, text = a_text, author=u, isRight=bool(random.randint(0,1)), rating=0)
            answ.save()
            createdAnswers+=1
            print('was created : ' + str(createdAnswers) + ' answers')
        print('==============================================')
        print('was created : ' + str(createdAnswers) + ' answers')



    # question = models.ForeignKey(Question)
    # text = models.TextField()
    # author = models.ForeignKey(User)
    # createdData = models.DateTimeField(default=timezone.now())
    # isRight = models.BooleanField(default=False)
    # rating = models.IntegerField(default=0)
コード例 #17
0
def answer_add(request):
    ask_id = str(request.META.get('HTTP_REFERER', "/").split('/')[-2])
    answer = Answer()
    # return HttpResponse(ask_id)
    answer.ask_id = ask_id
    if request.method == 'POST':
        af = AnswerForm(request.POST)
        if af.is_valid():
            # 获取表单内容
            content = af.cleaned_data['answer']
            answer.content = content
            answer.save()
            return render_to_response('ask/answer_add_done.html',
                                      {'content': content})
    else:
        af = AnswerForm()
    return render_to_response('ask/answer_add.html', {'af': af})
コード例 #18
0
    def handle(self, *args, **options):
        fake = Factory.create()

        min_number = int(options['min_number'])
        max_number = int(options['max_number'])

        users = User.objects.all()[1:]
        questions = Question.objects.all()

        for q in questions:
            for i in range(0, randint(min_number, max_number)):
                ans = Answer()
                ans.text = fake.paragraph(nb_sentences=randint(2, 10),
                                          variable_nb_sentences=True)
                ans.auth = choice(users)
                ans.question = q
                ans.save()
コード例 #19
0
ファイル: views.py プロジェクト: ermishechkin/django_ask
def add_answer(request):
    try:
        data = request.POST
        qid = int(data['qid'])
        content = data['content']
        a = Answer(text=content, author=request.profile, question_id=qid)
        a.save()

        ans_html = str(render_to_response('a.html', {'answer': a}).content)
        post('https://alex-erm.ru/pub?id=' + str(qid), ans_html)

        return JsonResponse(data={'status': 'OK', 'id': a.id})
    except Exception:
        return JsonResponse(data={
            'status': 'error',
            'msg': 'incorrect request'
        })
コード例 #20
0
ファイル: views.py プロジェクト: tohasvs/Sky-Ask-Site
def answers(req):
	c = 30
	first_range = range(1, 6)
	if not "name" in req.session:
		 return HttpResponse('{"status":"error","code":"5"}'); #Only for registered users
	if "qst" in req.POST and "text" in req.POST:
		qst_id = req.POST['qst']
		text = req.POST['text']
		# handling a text
		if qst_id and text:
			try:
				q = Question.objects.get(id = qst_id)
				u = User.objects.get(id=req.session["name"])
				d = datetime.datetime.now()
				a = Answer(content = text, qst = q, user = u, date = "{0}-{1}-{2}".format(d.year, d.month, d.day)
									, flag = False, raiting = 0)
				a.save()
				lng = Answer.objects.filter(qst = qst_id).count()
				total = int(math.ceil(float(lng) / c)) # Number of pages (All pages)
				res = Answer.objects.filter(qst = qst_id)[(total - 1) * c : lng]
				s = ""
				for i in res:
					try:
						s = s + '{{"id":"{0}", "content":"{1}", "user":"******", "date":"{3}", "raiting":"{4}", "user_name":"{5}"}},'.format(i.id, i.content, i.user.id, i.date.strftime("%h %d, %Y"), i.raiting, i.user.name)
					except:
						s = s + '{{"id":"{0}", "content":"{1}", "user":"******", "date":"{3}", "raiting":"{4}", "user_name":"{5}"}},'.format(i.id, i.content, i.user.id, i.date, i.raiting, i.user.name)
				s = s[0:-1]
				
				show_first = True
				start = total - 3
				end = total 
				
				if total in first_range:
					show_first = False
					start = 1
				
				pag = '{{"show_first":"{0}", "start": "{1}", "end": "{2}"}}'.format(show_first, start, end);
				return HttpResponse('{{"status":"ok","asw":[{0}], "total":"{1}", "pag":{2}}}'.format(s, total, pag))
			except (Question.DoesNotExist, Answer.DoesNotExist, User.DoesNotExist):
				return HttpResponse('{"status":"error","code":"3"}') #Question or User Doesn't exist
	
	return HttpResponse('{"status":"error","code":"4"}')
コード例 #21
0
ファイル: views.py プロジェクト: MuratovKl/Web
def setup():
    f = Faker()
    tags = f.words(nb=20)
    for i in tags:
        a = Tag(tag=i)
        a.save()

    for i in range(100):
        tt = f.text(50)
        te = f.text()
        a = Question(title=tt, text=te, author_id=randint(2, 4))
        a.save()
        a.tags.add(randint(1, 20), randint(1, 20), randint(1, 20))

    for i in range(300):
        te = f.text()
        an = Answer(text=te,
                    author_id=randint(2, 4),
                    question_id=randint(1, 100))
        an.save()
コード例 #22
0
ファイル: views.py プロジェクト: sng1996/DjangoProject
def answer(request, question_id):
	answer = Answer.answers.answer(question_id)
	during_question = Question.questions.question(question_id)
	if request.POST:
		form = AnswerForm(request.POST)
		if form.is_valid():
			text = form.cleaned_data.get('text')
			author = request.user
			question = during_question
			a = Answer(
				text = text,
				author = author,
				question = question)
			a.save()
			return redirect('/')
	form = AnswerForm()	
	return render(request, 'answer.html', {
		'answers' : answer,
		'question' : during_question,
		'form' : form
	})
コード例 #23
0
def generate_answers(n):
    arr = open('/home/hase/technopark/web/AskZaytsev/scripts/text.txt',
               'r').read().split(' ')
    asize = len(arr)
    ucount = Profile.objects.count()
    qcount = Question.objects.count()

    for i in range(0, n):
        print(i)
        word_cnt = random.randint(20, 50)
        text = ''
        title = arr[random.randint(0, asize - 1)] + ' ' + str(i)
        own = Profile.objects.filter(id=random.randint(1, ucount))[0]

        for j in range(0, word_cnt):
            text += arr[random.randint(0, (asize - 1))] + ' '

        q = Question.objects.filter(id=random.randint(1, qcount))[0]
        a = Answer(owner=own, question=q, title=title, text=text)
        a.save()
    print('ans')
コード例 #24
0
ファイル: views.py プロジェクト: kalter704/Web_technology
def answer(request, pk): 
	form = NewAnswer()
	num_answer_on_page = 3
	pk = int(pk)
	question = Question.objects.get(id=pk)
	
	new_answer = False
	position_of_answ = 0
	
	if request.POST:
		text = request.POST.get('text')
		if text != '':
			a = Answer(question = question,	text = text, author = request.user)
			a.save()
			new_answer = True
			position_of_answ = a.id
	
	if new_answer:
		request.GET = {'page': 'last'}
	
	answers_list = Answer.objects.filter(question__id=pk)
	answers = paginateObjects(request, answers_list, num_answer_on_page)
	pag = paginatorIndex(answers.number, answers.paginator.num_pages)
	#print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	#print pag['dotFirst']
	#print pag['pr']
	#print answers.number
	#print pag['ne']
	#print pag['dotLast']
	context = {
		'question': question,
		'answers': answers,
		'pag': pag,
		'form': form,
		'new_asnwer': new_answer,
		'position': position_of_answ
	}
	#return redirect('/answer/' + str(pk))
	return render(request, 'answer.html', context)
コード例 #25
0
ファイル: views.py プロジェクト: ArturAmbartsumov/TP_web
def newanswer(request, question_id):
    if request.user.is_authenticated():
        q = get_object_or_404(Question, pk=question_id)
        u = request.user
        user = u.customuser
        answer_form = AnswerForm(request.POST)  # A form bound to the POST data
        if answer_form.is_valid():  # All validation rules pass
            answer = Answer(
                ansver_text=answer_form.cleaned_data["ansver_text"],
                customuser=user,
                question=q,
                pub_data=timezone.now(),
                flag=0,
            )
            answer.save()
            request.session["message"] = "Your question was successfully added!!"
            request.session["flag"] = 1
        else:
            request.session["message"] = "Error!!"
            request.session["flag"] = 1
    else:
        request.session["message"] = "You must be logged in"
        request.session["flag"] = 0
    return HttpResponseRedirect(reverse("detail", args=(question_id,)))  # Redirect after POST
コード例 #26
0
ファイル: fill.py プロジェクト: burmistrovm/dbserver
 def handle(self, *args, **options):
     User.objects.all().delete()
     user = User.objects.create_user("nuf", "*****@*****.**", "nuf")
     user.save()
     tagmas = [
         'ActionScript', 'Ada', 'Bash', '(Visual) Basic', 'Bourne Shell',
         'Bro', 'C', 'C Shell', 'C#', 'C++', 'Curl', 'Fortran', 'Go',
         'Haskell', 'Java', 'JavaScript', 'Lisp', 'Maple', 'Mathematica',
         'MATLAB', 'MOO', 'Objective-C', 'Pascal', 'Perl', 'PHP', 'Python',
         'Ruby', 'Simulink', 'Verilog', 'VHDL'
     ]
     Question.objects.all().delete()
     Tags.objects.all().delete()
     for i in range(1, 10):
         q = Question(
             author=user,
             text=
             'In eget neque in turpis suscipit tristique vitae nec mauris. Vestibulum auctor, turpis non lobortis gravida, nisi est vulputate lectus, ut dictum erat augue ut erat.',
             title='title' + str(i),
             question_id=i,
         )
         q.save()
         t1 = Tags(name=tagmas[(i - 1) * 2])
         t2 = Tags(name=tagmas[(i - 1) * 2 + 1])
         t1.save()
         t2.save()
         t1.question.add(q)
         t2.question.add(q)
         for j in range(1, 10):
             a = Answer(
                 text=
                 'In eget neque in turpis suscipit tristique vitae nec mauris. Vestibulum auctor, turpis non lobortis gravida, nisi est vulputate lectus, ut dictum erat augue ut erat. In fringilla tincidunt dolor, at pulvinar lacus cursus nec. Pellentesque ultrices eget odio ac ullamcorper. Duis turpis orci, tempor vel massa id, posuere condimentum purus. Sed rutrum magna non nisi posuere interdum. Vivamus eget diam dictum mi malesuada accumsan.',
                 author=user,
                 question=q,
             )
             a.save()
def create_qusetion_answer_and_connect_user(how_many):
	does_NOT_exist_users = ''
	for j in range(how_many):
		### User get random
		user_id = random.randint(1, 10362)
		try:
			u = User.objects.get(id=user_id)
		except:
			does_NOT_exist_users = does_NOT_exist_users + str(user_id) + ' '
			user_id = random.randint(1, 10362)
			try:
				u = User.objects.get(id=user_id)
			except:
				does_NOT_exist_users = does_NOT_exist_users + str(user_id) + ' '
				user_id = random.randint(1, 10362)
				u = User.objects.get(id=user_id)
		### End User get random
		
		### Tag create
		start_tag_lenght = 3
		end_tag_lenght = 6
		t_text = randomword(start_tag_lenght, end_tag_lenght)
		
		t = Tag(text = t_text)
		
		t.save()
		### End Tag create
		
		### Question create
		question_length_low = 8
		question_length_high = 15
		q_title = randomword(question_length_low, question_length_high)
		for i in range(random.randint(0, 2)):
			q_title = q_title + ' ' + randomword(question_length_low, question_length_high)
		q_title = q_title  + '?'
		q_text = randomword(question_length_low, question_length_high)
		for i in range(random.randint(3, 20)):
			q_text = q_text + ' ' + randomword(question_length_low, question_length_high)
		q_rating = random.randint(-10, 150)
		
		q = Question(title = q_title,
					 text = q_text,
					 author = u,
					 rating = q_rating
					 )
					 
		q.save()
		q.tags.add(t)
		q.save()
		### End Question create
		
		### User get random
		ser_id = random.randint(1, 10362)
		try:
			u = User.objects.get(id=user_id)
		except:
			does_NOT_exist_users = does_NOT_exist_users + str(user_id) + ' '
			user_id = random.randint(1, 10362)
			try:
				u = User.objects.get(id=user_id)
			except:
				does_NOT_exist_users = does_NOT_exist_users + str(user_id) + ' '
				user_id = random.randint(1, 10362)
				u = User.objects.get(id=user_id)
		### End User get random
		
		### Answer create
		answer_length_low = 8
		answer_length_high = 15
		a_text = randomword(answer_length_low, answer_length_high)
		for i in range(random.randint(7, 25)):
			a_text = a_text + ' ' + randomword(answer_length_low, answer_length_high)
		a_right_answer = True
		
		a = Answer(question = q,
				   text = a_text, 
				   right_answer = a_right_answer, 
				   author = u
				   )
		a.save()
		### End asnwer create
		print('Create: ' + str(j))
	print('Create: ' + str(how_many))
	print(does_NOT_exist_users)
コード例 #28
0
    def handle(self, *args, **options):
        user_range = 25
        ask_range = 37
        answers_range = 97

        f_name = [
            'Red', 'Mad', 'Dummy', 'Crazy', 'Big', 'Black', 'Lonely', 'Shiz',
            'Drunken', 'Wicked', 'Brainless', 'Rich', 'Stubborn', 'Stupid',
            'Fat', 'Wooden', 'Donald', 'American', 'Dead', 'Lucky', 'Night'
        ]
        l_name = [
            'Sailor', 'Rat', 'Man', 'Rabbit', 'Donkey', 'Policeman', 'Child',
            'Penguin', 'Joker', 'Lawmaker', 'Judge', 'Iron', 'President',
            'Trump', 'Duck', 'Timmy', 'Kartman', 'Kenny', 'Orc', 'Illuminati',
            'Band', 'Slave', 'Coffee', 'Aviato', 'Redneck', 'Camper', 'King'
        ]

        for i in range(0, user_range):
            username = u'{0}{1}'.format(
                f_name[random.randrange(0, len(f_name))],
                l_name[random.randrange(0, len(l_name))])
            email = u'{0}@e-corp.com'.format(username)

            password = u'{0}123'.format(username)

            try:
                User.object.create_user(username=username,
                                        email=email,
                                        password=password)
            except:
                username = u'{0}{1}'.format(username, i)
                email = u'{0}@e-corp.com'.format(username)
                User.object.create_user(username=username,
                                        email=email,
                                        password=password)

        tags_list = [
            'LOL',
            'mad',
            'wazzzup',
            'DonaldTrump',
            'luxury',
            'shaurma',
            'Skynet',
            'TheyAreWatchingYou',
            'illuminati',
            'Futurama',
            'Bender',
            'BlackJack',
            'TacoBell',
            'BreakingBad',
        ]

        for tag in tags_list:
            try:
                new_tag = Tag()
                new_tag.title = tag
                new_tag.save()
            except:
                pass

        f_question = ['How to', 'Why to', 'Can I', 'What if']
        l_question = ['fly', 'run', 'jump', 'degrade', 'capture the world']

        users = User.object.all()
        users_count = len(users)

        tags_list = Tag.objects.all()
        tags_count = len(tags_list)

        for i in range(0, ask_range):
            ask = Ask()

            random_pk = random.randrange(1, users_count)
            ask.author = users[random_pk]
            ask.question = u'{0} {1}'.format(
                f_question[random.randrange(0, len(f_question))],
                l_question[random.randrange(0, len(l_question))])
            ask.text = u'{0} question by {1}'.format(ask.question,
                                                     ask.author.username)

            ask_tags = []
            tags_range = random.randrange(1, 4)
            for i in range(0, tags_range):
                ask_tags.append(tags_list[random.randrange(0, tags_count)])

            ask.rating = random.randrange(
                -10, 30)  # temporary remove later by UserVote
            ask.save()
            ask.tags = set(ask_tags)
            ask.save()

        asks = Ask.objects.all()
        asks_count = len(asks)

        f_answer = ['Just', 'I dont', 'May be', 'You should']
        l_answer = ['do it', 'know', 'know', 'forget it']

        for i in range(0, answers_range):
            answer = Answer()

            random_pk = random.randrange(1, users_count)
            answer.author = users[random_pk]

            ask_pk = random.randrange(1, asks_count)
            answer.ask = asks[ask_pk]

            answer.text = u'{0} {1}'.format(
                f_answer[random.randrange(0, len(f_answer))],
                l_answer[random.randrange(0, len(l_answer))])
            answer.save()