7๐
python_2_unicode_compatible
feature has only been added in Django 1.5 version.
https://docs.djangoproject.com/en/dev/ref/utils/#django.utils.encoding.python_2_unicode_compatible
34๐
For the latest Django 3.0.4 , and auditlog try
from six import python_2_unicode_compatible
instead of
from django.utils.six import python_2_unicode_compatible
if it is not install run the below code
pip install six
- [Django]-How to dynamically compose an OR query filter in Django?
- [Django]-Fighting client-side caching in Django
- [Django]-Django set range for integer model field as constraint
16๐
try
from django.utils.six import python_2_unicode_compatible
instead of
from django.utils.encoding import python_2_unicode_compatible
this works well for me in Django 1.10.6
- [Django]-Django Rest Framework: Access item detail by slug instead of ID
- [Django]-How can I embed django csrf token straight into HTML?
- [Django]-What's the reason why Django has SmallIntegerField?
8๐
I faced the same issue when I upgraded the Django version 2.x to 3.x.
This issue, I faced due to auditlog
library.
First, execute the below command
pip uninstall auditlog
then
pip install auditlog3
- [Django]-Extend base.html problem
- [Django]-Retrieving parameters from a URL
- [Django]-Many-To-Many Fields View on Django Admin
6๐
For me the issue was django-jet
package which is not compatible with django3
there is an issue on django-jet
github apparently you need to use django-3-jet
instead.
- [Django]-Start celery worker throws "no attribute 'worker_state_db'"
- [Django]-Django form got multiple values for keyword argument
- [Django]-Multiple Database Config in Django 1.2
5๐
I ran into this issue when I wanted to use Django for Graphite.
Turns out I had Django 1.3 installed and my Graphite version was breaking with Django > 1.5, so installing the latest version of the 1.4 branch fixed the problem:
sudo pip install --upgrade 'Django<1.5'
- [Django]-Access Django model's fields using a string instead of dot syntax?
- [Django]-Set all pages to require login, globally?
- [Django]-Django Admin app or roll my own?
3๐
Itโs actually also present in the 1.4 series since 1.4.2. You should really be using the latest 1.4.X release (1.4.10 as of the time of this writing) as earlier versions have known security vulnerabilities.
- [Django]-What is the correct way of returning an empty queryset in a Django View?
- [Django]-Retrieving a Foreign Key value with django-rest-framework serializers
- [Django]-Django: Adding "NULLS LAST" to query
1๐
I was having a same error while i was using the Djnago-multiselect app
that was becuase the app was trying to run the following import
from django.utils.encoding import python_2_unicode_compatible
But in the newer version of django python_2_unicode_compatible is not in the encodings.py but rather in the six module and install if six is not there for you using
pip install six
and then go to the django.utils.encoding.py file
and simply import python_2_unicode_compatible from six like that
from six import python_2_unicode_compatible
- [Django]-Simple search in Django
- [Django]-Import error cannot import name execute_manager in windows environment
- [Django]-Django REST Framework custom fields validation
1๐
I have founded same problem :
from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible'
I have update python version to python3.8, and I worked for me.
- [Django]-Django: templatedoesnotexist gis/admin/openlayers.html
- [Django]-What's the best option to process credit card payments in Django?
- [Django]-Generating a non-sequential ID/PK for a Django Model
0๐
There is an existing package that supports Django 3:
auditlog3
You can install it via pip install auditlog3
- [Django]-Is there a filter for divide for Django Template?
- [Django]-Django: timezone.now vs timezone.now()
- [Django]-Get Timezone from City in Python/Django
0๐
I have this upgrading Django 1.9 (Python 2.7) to Django 3.2 (Python 3.9).
You can solve this with a bash one liner:
grep -ril "from django.utils.encoding import python_2_unicode_compatible" your_project_source_code | xargs sed -i 's@from django.utils.encoding import python_2_unicode_compatible@from django.utils.six import python_2_unicode_compatible@g'
- [Django]-ProgrammingError: relation "django_session" does not exist error after installing Psycopg2
- [Django]-How to render menu with one active item with DRY?
- [Django]-Easy-to-use django captcha or registration app with captcha?
0๐
I was using Django in another computer, but wanted to copy the project with the virtual environment, too. It didnโt work, so I had to recreate the environment.
I got this error because I missed out one package from many:
django-background-tasks
So I had to install this package, and it solved the error.
- [Django]-Django-orm case-insensitive order by
- [Django]-Comma separated lists in django templates
- [Django]-Can I make list_filter in django admin to only show referenced ForeignKeys?
0๐
Step 1: Install six by command: pip install six
Step 2: Go to the file: your_venv/lib/python3.7/site-packages/django/utils/encoding.py
Step 3: Add this line to your file: from six import python_2_unicode_compatible
- [Django]-Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually
- [Django]-Django authentication without a password
- [Django]-OneToOneField() vs ForeignKey() in Django
0๐
for me replacing
from django.utils.encoding import python_2_unicode_compatible
with
from django.utils.six import python_2_unicode_compatible
with installing below library works!
pip install django-utils-six
- [Django]-Access ForeignKey set directly in template in Django
- [Django]-How to simplify migrations in Django 1.7?
- [Django]-Django 1.4 โ can't compare offset-naive and offset-aware datetimes