djhtmx icon indicating copy to clipboard operation
djhtmx copied to clipboard

This makes the HTMX Component a pydantic.BaseModel

Open edelvalle opened this issue 3 years ago • 3 comments

The implications are:

  • Rename Component.template_name -> Component._template_name
  • Move the logic Component.__init__ -> Component.mount The __init__ is now handled by pydantic

edelvalle avatar Oct 21 '21 21:10 edelvalle

I like the idea, because now when I create a base HTMX component I have to repeat its __init__ arguments in all subclasses. So, +1; however, this is breaking change, so I would make it another Component class and deprecate the current one.

I will work on this proposal.

mvaled avatar Nov 17 '21 18:11 mvaled

The README needs to be updated.

edelvalle avatar Nov 23 '21 20:11 edelvalle

The README needs to be updated.

I'm on the process of doing all of this. I went for the breaking change version, but even breaking the import which I find more dev-friendly because it won't even allow you to run the server while developing because an ImportError.

This is still not ready yet. It will take some time to complete.

mvaled avatar Nov 23 '21 20:11 mvaled