Go to file
sosokker c116a2ff0d Update Test and Model for Default pub_date Handling
In this commit, I change default field of pub_date into auto_add_now and it change the way pub_date assign work so I need to add several updates to address issues and errors in the code and tests related to the handling of the pub_date attribute in the Question model.

Test Updates
- Modified the create_question function in tests to accept pub_date when necessary and set it explicitly in the tests to match the new model definition.

Ensured the correct ordering of past questions in the index view.

Model Update
- Modified the Question model to use auto_now_add=True for pub_date to set it to the current date and time automatically.
2023-09-08 22:36:41 +07:00
.github/workflows Create flake8-lint.yml 2023-09-05 20:33:10 +07:00
data Delete db.sqlite3 from remote repos/ Add superuser and poll data to remote 2023-08-31 17:25:12 +07:00
mysite Externalize DEBUG, TIMEZONE, ALLOW_HOST and Add Install instruction in README.md 2023-09-05 21:44:19 +07:00
polls Update Test and Model for Default pub_date Handling 2023-09-08 22:36:41 +07:00
.gitignore Delete db.sqlite3 from remote repos/ Add superuser and poll data to remote 2023-08-31 17:25:12 +07:00
manage.py Creating a Django project. 2023-08-26 16:08:33 +07:00
README.md Externalize DEBUG, TIMEZONE, ALLOW_HOST and Add Install instruction in README.md 2023-09-05 21:44:19 +07:00
requirements.txt Add is_published, can_vote to QuestionModel/ Add test for can_vote, is_published 2023-09-05 21:25:04 +07:00
sample.env Externalize DEBUG, TIMEZONE, ALLOW_HOST and Add Install instruction in README.md 2023-09-05 21:44:19 +07:00

KU Polls: Online Survey Questions

Unit Tests

An application to conduct online polls and surveys based on the Django Tutorial project, with additional features.

Install and Run

  1. Install Python 3.11.4 or later
  2. Run these commands to clone and install requirements.txt
git clone https://github.com/Sosokker/ku-polls
cd ku-polls
pip install -r requirements.txt
  1. Create file call .env in ku-polls directory and add this line
SECRET_KEY=your_secret_key

You can generate your own your_secret_key by this command

python manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

or

Don't forget to change your_secret_key to your secret key (without quote)

You can look at sample.env for more information and others environment variables to set.

  1. Run these commands
python manage.py migrate
python manage.py loaddata data/polls-v1.json
python manage.py loaddata data/user.json
python manage.py runserver

Then connect to http://127.0.0.1:8000/ or localhost:8000/

Recommend

You can create virtual environment by using this command before install requirements.txt

  1. Install virtualenv via pip
python -m pip install --user virtualenv
  1. Run these commands
python -m virtualenv .venv
  1. Use virtual environment
.venv\Scripts\activate

Demo Superuser

Username Password
admin ineedmorebullets

Project Documents

All project documents are in the Project Wiki.

django-tutorial