ku-polls/polls/tests/base.py
sosokker b730333de3 Add Vote View Test and Recode it a bit + Seperate test
Change Model a bit and migrate back
Update Login, Signup UI a bit
2023-09-14 21:47:12 +07:00

14 lines
537 B
Python

from django.utils import timezone
from django.contrib.auth.models import User
from ..models import Question, Vote, Choice
def create_question(question_text, day=0):
"""
Create a question with the given `question_text` and published the
given number of `days` offset to now (negative for questions published
in the past, positive for questions that have yet to be published).
"""
time = timezone.now() + timezone.timedelta(days=day)
return Question.objects.create(question_text=question_text, pub_date=time)