# Why \`update\_dict\` or \`save\` of \`Collection.models\` don't update when I add a new field to \`NotetypeDeck\`?

**URL:** <https://forums.ankiweb.net/t/why-update-dict-or-save-of-collection-models-dont-update-when-i-add-a-new-field-to-notetypedeck/62712>\
**Category:** Development\
**Created:** [June 15, 2025, 6:29pm UTC](https://forums.ankiweb.net/t/why-update-dict-or-save-of-collection-models-dont-update-when-i-add-a-new-field-to-notetypedeck/62712 "2025-06-15T18:29:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrascsanyi](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@andrascsanyi](https://forums.ankiweb.net/u/andrascsanyi)\
**Post date:** [June 15, 2025, 6:29pm UTC](https://forums.ankiweb.net/t/why-update-dict-or-save-of-collection-models-dont-update-when-i-add-a-new-field-to-notetypedeck/62712/1 "2025-06-15T18:29:47Z")

</div>

I want to achieve the following:

- generating anki cards from a latex book with a custom note type

For this I created a script calling the python api to facilitate all the needed magic.  
I need a custom note type to add examples, theorems, proofs and other stuff to the cards, and since it is math, the latex part also need to be modified.

I want all control at the script and I don’t want to touch the UI for editing, meaning note type has to be managed in the script with the latex changes.

I have this [MR](https://github.com/Andras-Csanyi/andrascsanyi_com/pull/72/files#diff-7491d56e971c4c31e5ff3d42196c8871ba3b3f64e7e04e90587cb44c63619aeaR26) to make this changes, and I experienced the following:

- I can create a new note type (card structure) programmatically, this is the “mathematics-generated” NotetypeDeck
- I can create a new deck
- I can modify the note type `latextPre` part, as you can see from the code
- I can add new fields to the NotetypeDeck using the `Collection.models` api, but when I try to save it either by `update_dict` or the `save` (deprecated) the new field is not saved (I haven’t checked the Rust side so far if the error is there). The problematic code is [here](https://github.com/Andras-Csanyi/andrascsanyi_com/pull/72/files#diff-7491d56e971c4c31e5ff3d42196c8871ba3b3f64e7e04e90587cb44c63619aeaR47), it is commented out as of now, but the update result says that it updates everything, but when I request it again the newly added field is not there.

Am I doing something wrong here?  
What is the good solution here?

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [June 17, 2025, 2:52pm UTC](https://forums.ankiweb.net/t/why-update-dict-or-save-of-collection-models-dont-update-when-i-add-a-new-field-to-notetypedeck/62712/2 "2025-06-17T14:52:32Z")

</div>

Unless I’m missing something, I don’t see you’re adding new fields anywhere in your code. No calls to `.new_field()` or changes to the `flds` property

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [July 17, 2025, 2:53pm UTC](https://forums.ankiweb.net/t/why-update-dict-or-save-of-collection-models-dont-update-when-i-add-a-new-field-to-notetypedeck/62712/3 "2025-07-17T14:53:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
