Custom app developpement

Technical aspects, customization, code samples.
Post Reply
yonnak
Posts: 2
Joined: Tue May 03, 2022 12:11 pm

Custom app developpement

Post by yonnak »

Hi,

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!
cephstore
Posts: 9
Joined: Sun May 22, 2022 3:16 am

Re: Custom app developpement

Post by cephstore »

Can you post more information about what you are trying to accomplish? Maybe some mockups? Will help understand better.
yonnak
Posts: 2
Joined: Tue May 03, 2022 12:11 pm

Re: Custom app developpement

Post 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
customapp.png (133.88 KiB) Viewed 553 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?
Last edited by yonnak on Fri Jun 03, 2022 6:30 am, edited 2 times in total.
cephstore
Posts: 9
Joined: Sun May 22, 2022 3:16 am

Re: Custom app developpement

Post 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.
joh
Posts: 4
Joined: Tue Jul 28, 2020 1:42 pm

Re: Custom app developpement

Post 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.
joh
Posts: 4
Joined: Tue Jul 28, 2020 1:42 pm

Re: Custom app developpement

Post by joh »

Hi!

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: https://github.com/johbo/botech-edms

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 https://docs.mayan-edms.com/chapters/de ... 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: https://github.com/johbo/botech-edms/tree/master/docker


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 https://gitlab.com/mayan-edms/mayan-edm ... 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: https://github.com/johbo/botech-edms/tr ... appearance

Hope it's helpful for someone!

Cheers

Johannes
Post Reply