Skip to content
Advertisement

ImproperlyConfigured: There are duplicate field(s) in PackageAdmin.fieldsets

I have a very simple model :

   class Package(models.Model):
    package_id = models.IntegerField()
    package_name = models.CharField(max_length=20)
    subscriptions = models.ManyToManyField('Subscription', blank=True, null=True)

here is the admin.py :

from django.contrib import admin
from auth.models import Subscription, Package

class PackageAdmin(admin.ModelAdmin):
    list_display = ('package_name', 'package_id')
    fieldsets = (
       (None, {
           'fields': ('package_name')
           }),
       ('Advanced options', {
           'fields': ('package_id')
           }),
    )

admin.site.register(Package, PackageAdmin)

This implementation give me the following error :

ImproperlyConfigured: There are duplicate field(s) in PackageAdmin.fieldsets

Any idea why ?

If I let the second ‘fields’ empty, I don’t get the error. But if I let the first ‘fields’ empty, I still have this error.

Advertisement

Answer

Björn Kristinsson did solve my issue (see in the comment of the original question)

It’s an odd error for it, but it just might be because your fields tuples aren’t well formed. Try changing them to ('package_name',) and ('package_id',).

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement