Re: dynamically excluding fields in admin form

2010-03-01 Thread Ch'marr
You could do this with some javascript, which might work better in the following scenario: If you change the state of Completed between True and False, then other options will be enabled/disabled for you by the javascript My "take" on the admin screens is its a facility to fiddle with the model,

Re: dynamically excluding fields in admin form

2010-02-28 Thread Preston Holmes
On Feb 28, 12:21 pm, Simon Davies wrote: > figured out how to do it using the get_form method like this: > > class AccessoryStockOrderAdmin(admin.ModelAdmin): >     form = AccessoryStockOrderForm >     def get_form(self, request, obj=None, **kwargs): >         form =

Re: dynamically excluding fields in admin form

2010-02-28 Thread Simon Davies
figured out how to do it using the get_form method like this: class AccessoryStockOrderAdmin(admin.ModelAdmin): form = AccessoryStockOrderForm def get_form(self, request, obj=None, **kwargs): form = super(AccessoryStockOrderAdmin, self).get_form(request, obj, **kwargs) if

dynamically excluding fields in admin form

2010-02-28 Thread Simon Davies
Hi I have a model which I access from the admin application. I want to exclude some fields dynamically. My model looks like this: class StockOrder(models.Model): number_of_items_pending_order = models.PositiveIntegerField(max_length=5, default=1) number_of_items_ordered =