How to insert custom html code between the fields in the form (modelform)?

I have a form that inherits from ModelForm. It has a field with a certain name (for example let it be a name) how to insert it after my html code? For example, to the template looked approximately so:
Of the options I have got only check the name field when rendering the form in a loop, and if the name matches 'name' insert your code. But I think this is an incorrect option. If I add my function inside the class (like I did to add custom code) and make it readonly, then I noticed that this field is not found. Are there any options to add my pseudo field to the form, or how it correctly to implement it?
I tried to do something like this:
class Data(ModelForm):
 class Meta:
 def my_tag(self):
 return "<hr>"
 model = PersonalInfo
 fields = ('last_name', 'my_tag', 'first_name', )
 widgets = {
 'last_name': TextInput(attrs={'class': 'fio form-control',}),
 'first_name': TextInput(attrs={'class': 'fio form-control',}),
June 8th 19 at 17:26
1 answer
June 8th 19 at 17:28
As a variant - to write own widget for name_field, which will output the desired html
something like
class TextInputWithOpts(forms.TextInput):

 def __init__(self, attrs={}):
 super(TextInputWithOpts, self).__init__(attrs)

 def render(self, name, value, attrs=None):
 output = []
 output.append(super(TextInputWithOpts, self).render(name, value, attrs))
 if value and hasattr(value, 'optional_html'):
 return mark_safe(u".join(output))

something about (not tested, but to dig in this direction)

Find more questions by tags Django