diff --git a/Dockerfile b/Dockerfile index 2c2bbdf9..e3fb9059 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # pull official base image FROM python:3.12.1-slim +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # set work directory WORKDIR /usr/src/rad @@ -17,9 +18,14 @@ RUN apt-get update && apt-get -y install postgresql postgresql-contrib git libca # install dependencies -RUN pip install --upgrade pip +#RUN pip install --upgrade pip COPY ./requirements.txt . -RUN pip install -r requirements.txt +RUN uv venv /opt/venv +# Use the virtual environment automatically +ENV VIRTUAL_ENV=/opt/venv +# Place entry points in the environment at the front of the path +ENV PATH="/opt/venv/bin:$PATH" +RUN uv pip install -r requirements.txt # copy project COPY . . \ No newline at end of file diff --git a/anatomy/models.py b/anatomy/models.py index 25f50297..37823c03 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -22,6 +22,7 @@ from collections import defaultdict from helpers.images import image_as_base64 import reversion +import urllib.parse image_storage = FileSystemStorage( # Physical file location ROOT @@ -540,6 +541,8 @@ class UserAnswer(UserAnswerBase): # s = self.answer.lower().strip() # s = s.translate(str.maketrans('', '', string.punctuation)) # return s + def get_answer_url_safe(self): + return urllib.parse.quote(self.answer_compare) def get_answer_string(self): return self.answer diff --git a/anatomy/templates/anatomy/mark.html b/anatomy/templates/anatomy/mark.html index 6e38c7bf..2641cbe4 100644 --- a/anatomy/templates/anatomy/mark.html +++ b/anatomy/templates/anatomy/mark.html @@ -38,22 +38,22 @@ {% for answer in user_answers %} {% if answer in answer_suggest_incorrect %} -
{{ answer }}{{ answer }}{{ answer }}{{ answer }}{{ answer }}{{ answer }}{{ answer }}{{ answer }}{{ answer }}{{ answer }}