Well, that took me on a path to enlightenment.  I learned quite a bit more 
about method resolution order, MRO.  On my journey, I also learned the new way 
of using super() in python 3.  I even stumbled upon type checking using mypy.  
And I learned that there are stub files available for Django with mypy.

Unfortunately, my CustomModelFormSet still does not work with one particular 
form/view.  It works in other form/views, though, so there’s a problem 
elsewhere to resolve.

Thank you for your insight, James!  It was most helpful!


From: [email protected] [mailto:[email protected]] On 
Behalf Of James Schneider
Sent: Wednesday, May 31, 2017 6:24 PM
To: [email protected]
Subject: Re: ModelFormset Into InlineFormset



On Wed, May 31, 2017 at 3:13 PM, Matthew Pava 
<[email protected]<mailto:[email protected]>> wrote:
I have a class CustomFormSet that inherits from BaseModelFormSet.  I would like 
to have another formset class that does everything CustomFormSet does but 
instead inherits from BaseInlineFormSet.  What is the best pythonic/Django way 
of doing that?


I would take the same approach that abstract model classes use. Collect the 
common functionality into a separate class, and mix the forms together with the 
desired inheritance hierarchy.

Since your inheritance hierarchy includes the Base*FormSet classes, your 
abstract form mixin can simply inherit from object to keep from adding 
unintended behavior.

-James

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX9xDt3moEQPGdgy3SBt3xvPV3z3eUGun6eq%3DMSPKh_hQ%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX9xDt3moEQPGdgy3SBt3xvPV3z3eUGun6eq%3DMSPKh_hQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d83bd1d4275c4abd921469c6271097b6%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to