Wow, that's much simpler. They should list that option on the admin documentation page. Many thanks!
On Feb 25, 10:58 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Thu, Feb 26, 2009 at 1:51 AM, jeff <jmsche...@gmail.com> wrote: > > > I'm trying to modify the default Site admin page to include an inline > > model. Everything seems to be working fine except that no matter what > > I try I can't get it to limit the fields displayed in the inline. When > > I go to the site edit page in the admin, it shows the standard site > > fields as it should, but it shows every field defined for the inline > > model, not just the one I tell it to. The relevant code is below. Any > > help would be greatly appreciated. > > > ----- > > # admin.py > > > from django.contrib import admin > > from django.contrib.sites.models import Site > > from django.contrib.sites.admin import SiteAdmin > > from django.forms.models import inlineformset_factory > > from lindt.sections.models import TopNav > > > admin.site.unregister(Site) > > > class TopNavInline(admin.StackedInline): > > model = TopNav > > formset = inlineformset_factory( > > Site, > > TopNav, > > fields = ('order',) > > ) > > extra = 0 > > max_num = 0 > > > class SiteAdminMod(SiteAdmin): > > inlines = [TopNavInline] > > > admin.site.register(Site, SiteAdminMod) > > Drop the formset = bit and simply provide fields = ['order'] in the > InlineModelAdmin definition. > > Alex > > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---