Hi, actually that is how I do it. I'm subclassing from admin.ModelAdmin and then set the form-field to the custom form I made. But maybe this really only works for forms in applications. I'll try that out. Thx
On 12 Dez., 14:31, Matias <gonzalezmat...@gmail.com> wrote: > Hi, > > How do you register the model in the admin site? > You should register your model using a ModelAdmin subclass. > > Here is some docs that may help > youhttp://docs.djangoproject.com/en/dev/ref/contrib/admin/ > > The ModelForms are ment to be used in your applications rather than the > admin site. > > Hope that helps > > Matias. > > On Fri, Dec 12, 2008 at 10:22 AM, Dennis Schmidt <metzelti...@googlemail.com > > > > > wrote: > > > Hello, > > > I have a problem with ModelForms in the django admin site. I want to > > exclude some fields so they won't be displayed when I edit the model > > in the admin site. This is my code: > > > class CommonInvoiceForm(forms.ModelForm): > > price_factor = forms.ChoiceField(choices=COST_FACTOR_CHOICES) > > > class Meta: > > from voipgo.accounting.invoices.models import CommonInvoice > > model = CommonInvoice > > exclude = ('template',) > > > So as you can see I add a new field to the form - which works as > > expected. But the 'template' field I don't want to have in there is > > still displayed. 'template' is a normal ForeignKey field in the model > > declaration. What am I doing wrong here? > > -- > :wq --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---