Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fill_db(): # temporary метод для заполнения бд read-only данными
- usr1 = User.objects.create(nickname='Nikita1')
- usr2 = User.objects.create(nickname='Nikita2')
- tag1 = QuestionTag.objects.create(name='html', description='All about HTML')
- tag2 = QuestionTag.objects.create(name='xml', description='All about XML')
- tag3 = QuestionTag.objects.create(name='android', description='Android OS tag')
- q = Question.objects.create(author=usr1, title='Turn off auth in ubuntu 19.10 in all components',
- text='How is it possible to turn off authentication everytime when pc wakes up after '
- 'sleep? Im just really tired of it, I am often closing m '
- 'y pc and then opening again and everytime Ubuntu requires password.. I know that my '
- 'pc is used by me only and I don '
- 't need to care about my information safety. I have already turned off authentication '
- 'on pc boot. Now I am talking c '
- 'oncretically about the "Log in" state after pc sleeping.', pub_date=timezone.now())
- QuestionTags.objects.create(question=q, tag=tag3)
- QuestionTags.objects.create(question=q, tag=tag1)
- QuestionLikes.objects.create(question=q, author=usr2, like=True)
- CommentToQuestion.objects.create(text='Good question. I am interested!', pub_date=timezone.now(), author=usr2, question=q)
- ans = Answer.objects.create(text='I know the answer. It is ...', pub_date=timezone.now(), author=usr2, question=q)
- CommentToAnswer.objects.create(text='But this is comment of question author.', pub_date=timezone.now(), answer=ans, author=usr1)
- AnswerLikes.objects.create(answer=ans, author=usr1, like=False)
- q = Question.objects.create(author=usr2, title='Second question', text='bla bla bla', pub_date=timezone.now())
- QuestionTags.objects.create(question=q, tag=tag2)
- q = Question.objects.create(author=usr2, title='Third question', text='bla bla bla', pub_date=timezone.now())
- QuestionTags.objects.create(question=q, tag=tag3)
- q = Question.objects.create(author=usr1, title='Hello world', text='bla bla bla', pub_date=timezone.now())
- QuestionTags.objects.create(question=q, tag=tag2)
- QuestionTags.objects.create(question=q, tag=tag1)
- QuestionTags.objects.create(question=q, tag=tag3)
- QuestionLikes.objects.create(question=q, author=usr2, like=False)
- print("FILL_DB SUCCESS")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement