On Sun, May 17, 2009 at 12:38 PM, ringemup <ringe...@gmail.com> wrote:
> > > Aha. I'm on 1.0. Can I still use custom validation on the ModelForm > if I use the ModelAdmin to exclude the fields? > > Thank you! > > > On May 17, 1:36 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > > On Sun, May 17, 2009 at 12:34 PM, ringemup <ringe...@gmail.com> wrote: > > > > > I'm trying to exclude some fields from an admin form, but the exclude > > > option on the ModelForm is being ignored, as far as I can tell. The > > > following is my code. When I view the admin page in question, "Entry > > > Form Initialized" is printed to the command line, but all the fields, > > > including blog and slug, appear on the page. Clearly I'm doing > > > something wrong, but I can't figure out what. > > > > > Would someone be so good as to point me in the right direction? > > > Thanks! > > > > > class EntryForm(forms.ModelForm): > > > def __init__(self, *args, **kwargs): > > > super(EntryForm, self).__init__(*args, **kwargs) > > > print 'EntryForm Initialized' > > > class Meta: > > > model = Entry > > > exclude = ('blog', 'slug') > > > > > class EntryAdmin(admin.ModelAdmin): > > > form = EntryForm > > > > > admin.register(Entry, EntryAdmin) > > > > What version of Django are you using? Django only respects the exclude > and > > field options from the form in the latest development version, you can > > instead use the exclude and field options on the ModelAdmin class > directly > > if you're using an older version. > > > > 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 > > > Yes. :) 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 -~----------~----~----~----~------~----~------~--~---