Why did Django 1.9 replace tuples () with lists [] in settings and URLs?

It is explained in issue #8846 (emphasis mine): In the documentation for ​Creating your own settings there’s a recommendation which reads “For settings that are sequences, use tuples instead of lists. This is purely for performance.” This is bunk. Profiling shows that tuples run no faster than lists for most operations (certainly looping, which we … Read more

Django 1.9: Field clashes with the field of non-existing field in parent model

I think that you shouldn’t use name certifier for that foreign key relation because class Profile actually has certifier, admin and designer fields(although by descriptor) according to docs and in that case names actually would clash. from django.contrib.auth.models import User c = Certifier.objects.create( type=”admin”, user=User.objects.latest(‘date_joined’), ) p = c.profile_ptr print(p.certifier) #username (admin) Change to something … Read more

Django 1.9 ImportError for import_module

django.utils.importlib is a compatibility library for when Python 2.6 was still supported. It has been obsolete since Django 1.7, which dropped support for Python 2.6, and is removed in 1.9 per the deprecation cycle. Use Python’s import_module function instead: from importlib import import_module The reason you can import it from django.utils.module_loading is that importlib.import_module is … Read more

How to perform filtering with a Django JSONField?

As per the Django JSONField docs, it explains that that the data structure matches python native format, with a slightly different approach when querying. If you know the structure of the JSON, you can also filter on keys as if they were related fields: object.filter(data__animal=”cat”) object.filter(data__name=”tom”) By array access: object.filter(data__0__animal=”cat”) Your contains example is almost … Read more

Why does Django make migrations for help_text and verbose_name changes?

You can squash it with the previous migration, sure. Or if you don’t want to output those migrations at all, you can override the makemigrations and migrate command by putting this in management/commands/makemigrations.py in your app: from django.core.management.commands.makemigrations import Command from django.db import models IGNORED_ATTRS = [‘verbose_name’, ‘help_text’, ‘choices’] original_deconstruct = models.Field.deconstruct def new_deconstruct(self): name, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)