Closed acholyn closed 5 months ago
The individual items in the mentions list could do with something to make it clearer they're separate items rather than one item with a long name - maybe bullet points, maybe just spacing?
Have implemented changes on the PR that pulls into this one since there were other issues fixed on there too
closes #390
When a
TextObjectField
(TOF
) instance is saved, a function will run toupdate_mentions
, which involves calling another function that turns the content into beautiful soup and searching for all<class="mention">
elements and then filters these so only the ones forfragment
,anonymousfragment
andtestimonium
are processed. The list of mentioned objects is returned toupdate_mentions
and this list is compared to the preexisting list of mentioned objects calledfragment_testimonia_mentions
. If the lists do not differ, nothing is updated. If they do differ,set_fragment_testimonia_mentions
is called with the list of items to add and a list of items to remove fromfragment_testimonia_mentions
. The items in the removal list are removed from the mentioned object'smentioned_in
set and are removed from theTOF.fragment_testimonia_mentions
, the reverse is true for items in the "to add" list.Upon completion, each
TOF
should have a list offragment_testimonia_mentions
and each of these items should have the parent/owner object of theTOF
in theirmentioned_in_list
(a property which extracts the related object of theTOF
s in thementioned_in
set.This should act as a sensible foundation for #358