Posts

Django Common or not so common Errors and solitons

How to solve (admin.E107) The value of 'list_display' must be a list or tuple in Django Today, we're going to solve one of the Django admin issues, which is: (admin.E107) The value of 'list_display' must be a list or tuple. This issue happens when you try to set something except list or tuple for list_display. For example: @admin.register(Topics) class EcoProductAdmin(admin.ModelAdmin):     list_display = "title" Output: <class 'core.admin.EcoProductAdmin'>: (admin.E107) The value of 'list_display' must be a list or tuple. As I said, to solve this issue, we must set a tuple or list. List: @admin.register(Topics) class EcoProductAdmin(admin.ModelAdmin):     list_display = ['title'] Tuple: @admin.register(Topics) class EcoProductAdmin(admin.ModelAdmin):     list_display = ('title',) Note: you must add a comma when you want to display one item.  python3 manage.py migrate --run-syncdb  

Django SQL Drivers

pip freeze asgiref==3.3.1 Django==2.1.15 django-pyodbc-azure-2019==2.1.0.0 graphistry==0.12.0 protobuf==3.13.0 pyarrow==1.0.1 pyodbc==4.0.30 pytz==2021.1 sqlparse==0.4.1 pip install mssql-django

Cheatsheet

Image
SQL DRIVERS: https://pypi.org/project/django-pyodbc-azure-2019/ Start New Project django-admin startproject mysite Add APP python manage.py startapp polls Start Webserver  python manage.py runserver Make Makemigrations python manage.py makemigrations And Migration python manage.py migrate Create Superuser python manage.py createsuperuser Auto-generate the models python manage.py inspectdb python manage.py inspectdb > models.py More Hacks: python manage.py migrate --fake python3 manage.py migrate --run-syncdb