Re: Inherit/Override custom Form class methods in a custom ModelForm class

2009-02-01 Thread Stewart
That's perfect. Thanks to both of you. --~--~-~--~~~---~--~~ 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 ema

Re: Inherit/Override custom Form class methods in a custom ModelForm class

2009-01-31 Thread Daniel Roseman
On Jan 31, 1:26 am, Malcolm Tredinnick wrote: > On Fri, 2009-01-30 at 12:19 -0800, Daniel Roseman wrote: > > [...] > > > This is an ideal case for mixins. A mixin is a basic class which is > > 'mixed in' to other classes, which inherit both the attributes of > > their base class and the mixin cla

Re: Inherit/Override custom Form class methods in a custom ModelForm class

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 12:19 -0800, Daniel Roseman wrote: [...] > This is an ideal case for mixins. A mixin is a basic class which is > 'mixed in' to other classes, which inherit both the attributes of > their base class and the mixin class. So, for example, you could do: > > class MyMixin(object)

Re: Inherit/Override custom Form class methods in a custom ModelForm class

2009-01-30 Thread Daniel Roseman
On Jan 30, 4:57 pm, Stewart wrote: > Hi. > > I have a subclass of Form with some of my own methods in it, what > would be the best way of getting those methods into a ModelForm > subclass. > > For example: > > class MyForm(forms.Form): >   def as_span(self): >     “format form in a html span” >