[Django]-Changes in admin utils module in Django

5👍

util modules were renamed to utils in Django 1.7 (release notes).

To update your code for Django 1.7+, replace the import

from django.contrib.admin import util

with

from django.contrib.admin import utils

Then change the code to

obj.update({
    'fields': utils.flatten_fieldsets(self.add_fieldsets),
})

1👍

The import path is django.contrib.admin.utils not django.admin.utils

so replace your import with –

from django.contrib.admin import utils

Leave a comment