Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a field in a Plomino form programmatically #839

Open
AshRaghav opened this issue Feb 15, 2018 · 4 comments
Open

Create a field in a Plomino form programmatically #839

AshRaghav opened this issue Feb 15, 2018 · 4 comments

Comments

@AshRaghav
Copy link

Hi @ebrehault,

I am sorry if this sounds utterly absurd but is there a way to create a new field in a form programmatically?

I wanted a web-shop product add-on for our Plone instance but I couldn't find one that is neither recent nor fully functional which means I am relying on Plomino to help me semi-automate the construction of one.

Thanks

@djay
Copy link
Contributor

djay commented Feb 16, 2018

Fields are just dexterity types (in plomino 2). Forms are also a dexterity type with a layout field which you can edit to insert the right markup for the field to show up. So you can just use normal dexterity apis. You can do it from JS via plone.restapi.

@AshRaghav
Copy link
Author

Thanks @djay - unfortunately we are still running 1.19.4 and I assume your suggestion may not work there?

I'll still have a look at Restapi to learn about its functioning.

@djay
Copy link
Contributor

djay commented Feb 16, 2018

@AshRaghav plone.rest won't work. The python apis for plomino 1 are similar to what I describe above but the objects are Archetype objects, so just look at that api.

@djay
Copy link
Contributor

djay commented Feb 16, 2018

@AshRaghav also have a look at the plomino code base, esp the tests. There are lots of examples of creating forms and fields in the doctests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants