﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19258	ModelAdmin customized queryset with extra option	honyczek	arank	"If you customize queryset in ModelAdmin:

{{{
from app.models import License, Server
from django.contrib import admin

class LicenseAdmin(admin.ModelAdmin):
  def queryset(self, request):
    qs = super(LicenseAdmin, self).queryset(request)
    return qs.extra(select={'usage_count': ""SELECT COUNT(id) FROM app_server WHERE license_id=license.id"",})

  list_display = ('name','description','product_key', 'usage_count')
  
admin.site.register(License, LicenseAdmin)
}}}

and want to use ''extra'' field called ''usage_count'', you get an error:

{{{
ImproperlyConfigured at /admin/app/license/

LicenseAdmin.list_display[3], 'usage_count' is not a callable or an attribute of 'LicenseAdmin' or found in the model 'License'.
}}}

Django Admin interface ignores extra field ''usage_count'' from QuerySet, or validates columns by another way, which doesn't include QuerySet changes."	Bug	closed	contrib.admin	1.4	Normal	duplicate			Accepted	0	0	0	0	0	0
