Re: Using a model method in ModelAdmin fieldsets

2009-01-08 Thread Andy
One more comment: You would also want to make sure that the init method of SampleForm populates the non-model fields (ie. lastname) with the correct values. class SampleForm(forms.ModelForm): lastname = form.CharField... def __init__(self, *args, **kwargs): super(SampleForm, self)

Re: Using a model method in ModelAdmin fieldsets

2009-01-08 Thread Andy
The better approach would be to specify a custom form in your ModelAdmin. This way your fieldset definition could include anything that's specified in your custom form. For Example: class SampleModel(models.Model): email = models.EmailField... firstname = models.CharField... class Sampl

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
Thanks Karen & Daniel, I think your overiding approach will work. Thank you. Implemented a work around. I added extra fields (that persist my method information) to my model that I update and save when I do a listing. Price I pay is an extra database update each time the model is getting list

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 11:45 AM, EagerToUnderstand wrote: > > What I try to achieve: > I have a couple of model methods that exposes real time information. > (Retrieved when method is called.) This is information I want to > display not only in the list_display, but also within the change view. >

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
What I try to achieve: I have a couple of model methods that exposes real time information. (Retrieved when method is called.) This is information I want to display not only in the list_display, but also within the change view. (Where the fieldsets come into play). Since the list_display option

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread Daniel Roseman
On Jan 7, 10:35 am, EagerToUnderstand wrote: > I am referencing a self defined model method in list_display option of > ModelAdmin. I would like to do the same in the fiedsets option of > ModelAdmin, but I get an error saying my method is missing from the > form when the page is rendered. It se

Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
I am referencing a self defined model method in list_display option of ModelAdmin. I would like to do the same in the fiedsets option of ModelAdmin, but I get an error saying my method is missing from the form when the page is rendered. It seems to me I can only render model methods with list_di