Repository: MicroPyramid/django-mfa (language: python)

Issue:
Support Django 3
`setup.py` indicates that you can't run this app with a Django version greater than 2.1.5. 

Could you update the code and/or dependency spec to support Django 3? Thanks!


Discussion / hints:
Sure @Datamance we will target that in a week
Having the same problem. Apparently can't install without psycopg2 and a bunch of deprecated packages that won't install alongside Django 3. 
Has there been any progress on this? Or would you be interested if I opened a pull request for the changes I've made to make it work on Django 3.2?
Hey,
I've just tried to get django_mfa version 2.1 working with django 3.2.4.final and here's what I had to change to get it to work:

1) Install missing requirement (this isn't documented):
    sudo pip3 install python-u2flib-server
2) Modify django_mfa/models.py (change field size from 10 to 20):
    secret_code = models.CharField(max_length=20)
3) Run this (isn't documented):
    python manage.py migrate
4) Include urls:
    path('settings/', include('django_mfa.urls'))

Hope this helps
Steve

The second issue with secret_code max_length has been fixed and merged into the repo on the 30th of July, would it be possible to create a release with it? :) 
I will get it done today @ausram 
Any news on that release @ashwin31?

Fix patch:
diff --git a/README.rst b/README.rst
index 9615914..6c79fe4 100755
--- a/README.rst
+++ b/README.rst
@@ -26,7 +26,7 @@ Django-mfa(Multi-factor Authentication) is a simple django package to add extra
 
 We welcome your feedback on this package. If you run into problems, please raise an issue or contribute to the project by forking the repository and sending some pull requests. 
 
-This Package is compatible with Django versions >=1.10 (including at least Django 2.0.7) Documentation is available at readthedocs(http://django-mfa.readthedocs.io/en/latest/)
+This Package is compatible with the following Django versions: 2.2, 3.0, 3.1, 3.2. Documentation is available at readthedocs(http://django-mfa.readthedocs.io/en/latest/)
 
 Quick start
 -----------
diff --git a/django_mfa/templates/django_mfa/base.html b/django_mfa/templates/django_mfa/base.html
index 598e02e..0b80de6 100755
--- a/django_mfa/templates/django_mfa/base.html
+++ b/django_mfa/templates/django_mfa/base.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-{% load staticfiles %}
+{% load static %}
 <html lang="en">
   <head>
     <meta charset="utf-8">
diff --git a/django_mfa/templates/u2f/base.html b/django_mfa/templates/u2f/base.html
index 28b93c7..c4b12b3 100644
--- a/django_mfa/templates/u2f/base.html
+++ b/django_mfa/templates/u2f/base.html
@@ -1,5 +1,5 @@
 {% extends base_template|default:"u2f_base.html" %}
-{% load staticfiles %}
+{% load static %}
 {% load i18n %}
 {% block content %}
 <script src="{% static 'django_u2f/u2f-api.js' %}"></script>
diff --git a/django_mfa/templates/u2f_base.html b/django_mfa/templates/u2f_base.html
index d7b1b5e..989c39b 100644
--- a/django_mfa/templates/u2f_base.html
+++ b/django_mfa/templates/u2f_base.html
@@ -1,5 +1,4 @@
 <!DOCTYPE html>
-{% load staticfiles %}
 {% load static %}
 <html lang="en" >
   <head>
diff --git a/docs/installation_setup.rst b/docs/installation_setup.rst
index 1fdf847..45b6947 100644
--- a/docs/installation_setup.rst
+++ b/docs/installation_setup.rst
@@ -5,8 +5,8 @@ Requirements
 ~~~~~~~~~~~~
 
 ======  ====================
-Python  >= 2.6 (or Python 3)
-Django  >= 1.11
+Python  3.6, 3.7, 3.8, 3.9, 3.10
+Django  2.2, 3.0, 3.1, 3.2
 ======  ====================
 
 Installation
diff --git a/requirements.txt b/requirements.txt
index e1579c1..93d4d41 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
-Django>=2.2.19
 black==20.8b1
--r sandbox/requirements.txt
\ No newline at end of file
+django-argonauts==1.2.0
+python-u2flib-server==5.0.0
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..48e3312
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,11 @@
+[tox]
+envlist = py{36,37,38,39,310}-django{22,30,31,32}
+
+[testenv]
+deps =
+    -rrequirements.txt
+    django22: Django>=2.2,<2.3
+    django30: Django>=3.0,<3.1
+    django31: Django>=3.1,<3.2
+    django32: Django>=3.2,<3.3
+commands = python test_runner.py


Test patch:
diff --git a/test_runner.py b/test_runner.py
index d967d0b..da6ada7 100644
--- a/test_runner.py
+++ b/test_runner.py
@@ -22,7 +22,6 @@
             'django.contrib.staticfiles',
             'django_mfa',
             'argonauts',
-            'debug_toolbar',
         ),
         MIDDLEWARE=(
             'django.middleware.security.SecurityMiddleware',
@@ -33,7 +32,6 @@
             'django.contrib.messages.middleware.MessageMiddleware',
             'django.middleware.clickjacking.XFrameOptionsMiddleware',
             'django_mfa.middleware.MfaMiddleware',
-            'debug_toolbar.middleware.DebugToolbarMiddleware',
         ),
         ROOT_URLCONF='django_mfa.urls',
         STATIC_URL='/static/',
@@ -52,6 +50,7 @@
                 },
             },
         ],
+        SECRET_KEY='test_secret_key',
     )
 
     django.setup()