AndrewIngram / django-extra-views

Django's class-based generic views are awesome, let's have more of them.
MIT License
1.38k stars 172 forks source link

Rename get_formset -> get_formset_class #180

Closed jonashaag closed 5 years ago

jonashaag commented 5 years ago

formset_class = self.get_formset()

That's a bit weird and inconsistent, it's called get_form_class in Django's views and I guess get_formset_class is more correct?

sdolemelipone commented 5 years ago

There's duplication of that method name due to the use of an intermediate factory method by Django. We first get a formset class from get_formset_class(), then pass that into formset_factory to get another formset class, then use that class in order to construct a formset instance.

We could rename it like this:

factory_class = self.get_factory_class() or factory_formset_class = self.get_factory_formset_class()

to indicate this is the formset class which comes back from the factory, with a deprecation warning on the old name. I'm not sure if the rename makes things any clearer though. What do you think?

jonashaag commented 5 years ago

Agreed, root of the naming problem is in Django, not something we should fix here.