0

Below source code is from django/forms/forms.py

class BaseForm(RenderableFormMixin):
    def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row):
    "Output HTML. Used by as_table(), as_ul(), as_p()."

How is this private method _html_output() used / invoked by as_table(), as_ul(), as_p() please ? I did not find out from the source code.

Yan Tian
  • 377
  • 3
  • 11
  • Please read about [private methods in python](https://stackoverflow.com/questions/70528/why-are-pythons-private-methods-not-actually-private) – Ankit Tiwari Dec 24 '21 at 07:45
  • thanks for sharing, I reviewed the link you shared, which does not clear my confusion. I believe that I understand how `private method` work and how to use it. As per my understanding, when any `methods` use `private methods`, they should explicitly invoke `private methods` during method definition. But I did not find that in the source code. – Yan Tian Dec 24 '21 at 08:20

1 Answers1

2

The method is no longer used

https://docs.djangoproject.com/en/4.0/releases/4.0/#id2

Since form rendering now uses the template engine, the undocumented BaseForm._html_output() helper method is deprecated

Iain Shelvington
  • 31,030
  • 3
  • 31
  • 50