ErwinKomen / RU-passim

0 stars 0 forks source link

Stemmatology: upload contents to Sermon #686

Closed ErwinKomen closed 1 year ago

ErwinKomen commented 1 year ago

There should be a button Add transcription in a Sermon, where the user can upload one (!) TEI-P5 XML containining one transcription

ErwinKomen commented 1 year ago

Implementation

  1. Add a file transcription to the model SermonDescr.
    1. This is a FileField. It makes use of the function transcription_path() to upload files to a media/transcription subdirectory on the server. That is where the TEI-P5 xml files will be stored.
    2. Added method get_trans_file() to retrieve the file (as File object)
  2. The view SermonEdit should now be made able to handle the file field
    1. Added the field to form SermonForm
    2. Added showing the file field in mainitems, but only if the user has enough (editing) rights
    3. Added code in after_save() to actually read the XML, extract the text from it and store it in field fulltext
  3. Created a method read_transcription() in reader/views.py (largely based on existing read_trans_eqg() )

Result

This really works very nice! Should take the same approach for EqualGold (AF/SSG), since such a XML file with a transcription really 'belongs' to one particular SSG or S. Will do so in issue #673

Remaining

Well, there is one thing remaining. If all XML files are going to be stored in one directory media/transcription, then how are we going to distinguish: (a) whether the XML is used for uploading to an S or SSG and (b) which S or SSG the file actually belongs to? Perhaps I should adapt the name of the file to include: type underscore id underscore filename ?

ErwinKomen commented 1 year ago

The above is done and working well.