Repository: jazzband/django-cookie-consent (language: python)

Issue:
Missing migration 0003_alter_cookie_id_alter_cookiegroup_id_and_more
I ran into a problem while trying to convert a site over to docker. I discovered that there is a missing migration 0003.

It would seem that running migrate on a new install will cause an error about the missing file. In a dev or local situation in which it's being run by a privileged user, it's fairly easy to solve by running makemigrations once, which will generate the missing file.

But, in docker, it's common to switch to a non-privileged user before running migrations, and it's generally discouraged from running makemigrations on prod servers. Attempting to run makemigrations as a non-privileged user causes an error when attempting to write out the missing migration file:

> PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.9/site-packages/cookie_consent/migrations/0003_alter_cookie_id_alter_cookiegroup_id_and_more.py'

So, ideally the migration file needs to be added to the package before that point. It looks like there is a pending PR for this very thing, which is quite convenient. I'm not entirely sure what the process is for approving PR's and getting those changes published out, but I'm willing to learn and help out where able.

In the mean time, my temporary fix which might work for others that are dealing with similar issues, is I just chowned the migrations directory and ran makemigrations. So the end of the dockerfile looks like:
```dockerfile
# hack to fix cookie toolbar
RUN chown -R appuser:appuser /usr/local/lib/python3.9/site-packages/cookie_consent/migrations

# change to the app user
USER appuser

# run entrypoint.prod.sh
ENTRYPOINT ["/home/appuser/web/entrypoint.sh"]
```

and these two lines in entrypoint.sh:
```shell
python manage.py makemigrations
python manage.py migrate
```


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2f3298d..cbb206f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,11 +16,12 @@ jobs:
     strategy:
       matrix:
         python: ['3.8', '3.9', '3.10']
-        django: ['3.2', '4.0', '4.1']
+        django: ['3.2', '4.1', '4.2']
         include:
-          - python: '3.7'
-            django: '3.2'
-
+          - python: '3.11'
+            django: '4.1'
+          - python: '3.11'
+            django: '4.2'
 
     name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})
 
diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml
index ebe460e..e8005ed 100644
--- a/.github/workflows/code_quality.yml
+++ b/.github/workflows/code_quality.yml
@@ -7,13 +7,7 @@ on:
       - master
     tags:
       - '*'
-    paths:
-      - '**.py'
-      - '**.cfg'
   pull_request:
-    paths:
-      - '**.py'
-      - '**.cfg'
   workflow_dispatch:
 
 jobs:
diff --git a/cookie_consent/apps.py b/cookie_consent/apps.py
index 604eeda..257a7e7 100644
--- a/cookie_consent/apps.py
+++ b/cookie_consent/apps.py
@@ -1,5 +1,8 @@
 from django.apps import AppConfig
+from django.utils.translation import gettext_lazy as _
 
 
 class CookieConsentConf(AppConfig):
     name = "cookie_consent"
+    verbose_name = _("cookie consent")
+    default_auto_field = "django.db.models.AutoField"
diff --git a/cookie_consent/migrations/0001_initial.py b/cookie_consent/migrations/0001_initial.py
index fb6c6be..06f893f 100644
--- a/cookie_consent/migrations/0001_initial.py
+++ b/cookie_consent/migrations/0001_initial.py
@@ -8,7 +8,6 @@
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = []
diff --git a/cookie_consent/migrations/0002_auto__add_logitem.py b/cookie_consent/migrations/0002_auto__add_logitem.py
index b39c823..f011310 100644
--- a/cookie_consent/migrations/0002_auto__add_logitem.py
+++ b/cookie_consent/migrations/0002_auto__add_logitem.py
@@ -5,7 +5,6 @@
 
 
 class Migration(migrations.Migration):
-
     dependencies = [
         ("cookie_consent", "0001_initial"),
     ]
diff --git a/docs/usage.rst b/docs/usage.rst
index 7d1233c..f408cf9 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -5,7 +5,7 @@ Usage
 Checking for cookie consent in views
 ------------------------------------
 
-::
+.. code-block:: python
 
   from cookie_consent.util import get_cookie_value_from_request
 
@@ -14,7 +14,9 @@ Checking for cookie consent in views
     if cc:
       # add cookie
 
-Checking if specific cookie in Cookie group is accepted is possible::
+Checking if specific cookie in Cookie group is accepted is possible:
+
+.. code-block:: python
 
     cc = get_cookie_value_from_request(request, "mycookies", "mycookie1")
 
@@ -23,7 +25,7 @@ Checking for cookie consent in templates
 
 Use ``cookie_group_accepted`` or ``cookie_group_declined`` template filters.
 
-::
+.. code-block:: django
 
   {% load cookie_consent_tags %}
   {% if request|cookie_group_accepted:"analytics" %}
@@ -45,7 +47,7 @@ of javascript code.
 When consent for using specific cookies is given, code can be evaluated
 without reloading page.
 
-::
+.. code-block:: django
 
   {% load cookie_consent_tags %}
   <script type="{% js_type_for_cookie_consent request "social" "*:.google.com" %}" data-varname="social">
@@ -125,4 +127,4 @@ Notes
 =====
 
 * Ensure that the elements with the class names ``cc-cookie-accept`` and
-``cc-cookie-decline`` are present within the content HTML string.
+  ``cc-cookie-decline`` are present within the content HTML string.
diff --git a/setup.cfg b/setup.cfg
index b41de13..7a70e09 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -20,18 +20,18 @@ classifiers =
     Development Status :: 3 - Alpha
     Framework :: Django
     Framework :: Django :: 3.2
-    Framework :: Django :: 4.0
     Framework :: Django :: 4.1
+    Framework :: Django :: 4.2
     Intended Audience :: Developers
     License :: OSI Approved :: BSD License
     Operating System :: Unix
     Operating System :: MacOS
     Operating System :: Microsoft :: Windows
     Operating System :: OS Independent
-    Programming Language :: Python :: 3.7
     Programming Language :: Python :: 3.8
     Programming Language :: Python :: 3.9
     Programming Language :: Python :: 3.10
+    Programming Language :: Python :: 3.11
     Topic :: Software Development :: Libraries :: Python Modules
 
 [options]
diff --git a/tox.ini b/tox.ini
index 9b46438..db65314 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,7 @@
 [tox]
 envlist =
-    py37-django32
-    py{38,39,310}-django{32,40,41}
+    py{38,39,310}-django{32,41,42}
+    py311-django{41,42}
     isort
     black
     ; flake8
@@ -10,16 +10,16 @@ skip_missing_interpreters = true
 
 [gh-actions]
 python =
-    3.7: py37
     3.8: py38
     3.9: py39
     3.10: py310
+    3.11: py311
 
 [gh-actions:env]
 DJANGO =
     3.2: django32
-    4.0: django40
     4.1: django41
+    4.2: django42
 
 [testenv]
 setenv =
@@ -30,8 +30,8 @@ extras =
     coverage
 deps =
   django32: Django~=3.2.0
-  django40: Django~=4.0.0
   django41: Django~=4.1.0
+  django42: Django~=4.2.0
 commands =
   pytest tests \
    --junitxml=reports/junit.xml \


Test patch:
diff --git a/testapp/settings.py b/testapp/settings.py
index ba4aa67..f24fc23 100644
--- a/testapp/settings.py
+++ b/testapp/settings.py
@@ -16,6 +16,8 @@
 
 DEBUG = True
 
+USE_TZ = True
+
 STATIC_URL = "/static/"
 TEMPLATES = [
     {