Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

106 views
Skip to first unread message

Richard Mayebo

unread,
Feb 2, 2022, 7:49:30 PM2/2/22
to Django users
Platform: Observed on Ubuntu 20.04

  1. Install MySQL (Observed on 5.7 and 8.0)
  2. Create a Virtual environment using venv, and activate it.
  3. Install Django 3.2.11
  4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
  5. Install django-easy-audit and/or django-axes (both these third party packages populate the Django Admin Site, where the apparent bug manifests).
  6. Create a superuser (python manage.py createsuperuser)
  7. Start Django (python manage.py runserver)
  8. Launch the Django Admin Site and log in with the superuser.
  9. The pane on the left hand side will have links to objects created by django-easy-audit and/or django-axes, depending on what was installed.
  10. Click on the "Request event" link under "Easy Audit Application" or "Access logs" under "Axes"
  11. RESULT: 
Template error: In template /home/......../.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html, error at line 44

   'NoneType' object has no attribute 'day' [OR  'NoneType' object has no attribute 'month'

This behaviour is observed on MySQL 5.7.37 and 8.0.26 using my-sql-connector 8.0.26 and 8.0.28.

Replacing MySQL with SQLite or PostgreSQL 12 solves the issue. 

Replacing the connector with mysqlclient-2.1.0 solves the issue. 

This implies there is a bug in the interaction between third-party packages like django-easy-audit and django-axes, Django 3.2.11 and my-sql-connector 8.0.26 and 8.0.28.

Has similar behaviour been observed by anyone else? In any case, how can this be brought to the attention of the development team?

My apologies if this is the wrong forum for this post. I am new at this.

Regards,
Richard.

Lakshyaraj Dash X-D 25

unread,
Feb 2, 2022, 9:01:51 PM2/2/22
to django...@googlegroups.com
Use only the mysqlclient package to populate your admin site with MySQL database.

You can watch this tutorial also : https://youtu.be/SNyCV8vOr-g

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com.

Jason

unread,
Feb 3, 2022, 8:10:05 AM2/3/22
to Django users
can you observe the same behavior in previous versions of connector?  You listed two patch versions, makes me curious where in the 8.x version line this works.  Likely this is an issue with mysql-connector-python, but with it being an Oracle product, it doesn't have much internal visibility.  So could be helpful to downgrade versions till you get a working one.

Richard Mayebo

unread,
Feb 3, 2022, 8:47:45 AM2/3/22
to django...@googlegroups.com
mysql-connector-python 8.0.27 has another bug (see  https://stackoverflow.com/questions/69900463/django-migration-error-typeerror-sequence-item-1-expected-a-bytes-like-object ) so I did not try it.

mysql-connector-python 8.0.26 did not have this problem with Django 3.1. So the bug must have been introduced in the transition to Django 3.2.

From what I am picking up (for example from Lakshyaraj Dash above), mysql-connector-python seems to be buggy generally and mysqlclient should be used as the first choice.  

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/s1s42RcxNMQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d3eda24e-ab25-406c-9992-3af6f98701c1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages