Page 1 of 1

Custom app developpement

Posted: Tue May 03, 2022 12:16 pm
by yonnak

I'm new to Mayan and Django.

I am developping a custom app to meet my requirements. I have a custom menu wich allow me to access custom views and templates.

I'm trying to display a document along with its metadatas in the same template but can not get it work.

Could someone point me in the right direction or provide some example code, please?

Thank you!

Re: Custom app developpement

Posted: Sun May 22, 2022 3:19 am
by cephstore
Can you post more information about what you are trying to accomplish? Maybe some mockups? Will help understand better.

Re: Custom app developpement

Posted: Tue May 24, 2022 1:06 pm
by yonnak
Hi, thank you for your help.

Here is my situation: the user have to flll some metadatas wich values are stored in the document. Once done he needs to launch the next transition of the workflow.

I'd like to have all of this in a single template: document preview, metadata edition form and, workflow transition button, like this:
customapp.png (133.88 KiB) Viewed 554 times
I can't inherit from both DocumentVersionPreviewView and DocumentMetadataEditView as, if I understand correctly, they share common functions definitions.

Is it possible to acheive something like that?

Re: Custom app developpement

Posted: Fri May 27, 2022 7:42 am
by cephstore
Your mockup looks like the upload wizard. Taking a look at the source upload wizard it seem the view type you need if the [MultiFormView:] and give it all the form classes you want to display. No idea how to change the layout though to get the left up and down display you need.

Also FYI, it good etiquette to post images directly in the forum and not in external links that could disappear in the future like all the images in the "Guides" topic.

Re: Custom app developpement

Posted: Tue Aug 23, 2022 10:49 am
by joh
How did it go? Did you achieve anything over the time?

I am struggling at a similar point and try to add a customized view which combines multiple elements like metadata and comments together with the preview display.

Re: Custom app developpement

Posted: Thu Aug 25, 2022 12:37 pm
by joh

Adding a pointer to my custom code into this thread, hope it to be useful for others who are trying to get going.

I've put my code public here into my Github account:

It's not yet a lot, still I got quite some insights while wrestling with the code.

1. Make a proper development setup.

Took my inspiration from the documentation at ... yment.html. I first went with a remote linux machine, but this turned out to be too time consuming and not very flexible.

My only challenge was that I did not have a debian style linux at hands, so I've embedded those instructions into a dockerfile to have it all run inside of a container. It's not yet a solid setup, still it might be a useful source of inspiration. The compose file and details are here:

2. Be familiar with Django's forms and utilities around views

While working I've found that inside of the codebase many Views use various Mixins and for the display of data Forms are quite commonly used. First I was banging my head because I could not really get around all those things without much of a documentation. Then I did discover similarities with concepts I did remember from plain Django, so I went and studied Django's documentation about Forms and also Views again to refresh myself. Even looking into the code of some of the classes. This did help a great deal to get behind the concepts in EDMS itself.

3. Get an overview of the generic templates

Studying the templates was super useful, esp. since I wanted to basically stay in the appearance of the EDMS UI. Find them in your local checkout or online in the Gitlab repository at ... appearance.

It took me a while to get behind "generic_form.html" and also the multiform variant. Looking backward, I find it vital to understand how "generic_form" plays together with "subtemplate" templates and the "form_instance" template. It's best to study the template code and experiment with those by creating a simple example view and rendering some of EDMS' forms.

Note: I had a usecase somewhat comparable to the one in this thread. I ended up customizing the templates, since I found myself in a need to have a wrapping "FORM" tag in the HTML output, and then render multiple forms inside of it with differing configurations. So I made a variant of "generic_form" which does render subtemplates without having each subtemplate have it's own FORM tag. This way I could achieve to group multiple Form classes into one bigger HTML FORM which can be submitted all together. The templates can be seen at the following URL: ... appearance

Hope it's helpful for someone!