Anki Forums

Creating model and backward incompatibilities

Hi,
when I want to create a model in my plugin I do something like:

    self.model = mw.col.models.new(self.NAME)
    self.model['tags'].append(self.NAME)

And it just works correctly on Anki 2.1.16. I realize this is no longer working on latest versions.
Is there a page on backward incompatibilities ans how am I supposed to create new models? is tag still needed?

Is there a place where it is explained the ratio of these changes? I see a porting from 2.0 to 2.1 but not from 2.1 to 2.1…

sandro

Ancient versions of Anki used to let the user tag their models, but this functionality hasn’t been exposed to the user since about 2012. If you are checking the tags in other parts of your code you’ll need to add the key if it’s missing; if you are not then you can just remove that line.

Thanks Damien,

I now have a plugin that works, but the problem is still open. Is there a backward incompatibilities page?

Probably this stems from the fact that I can’t find official API, so no incompatibilities…

In this moment I realized that I used to issue:

mw.col.models.update(self.model)

After adding templates on a new model, now this raises error and is probably not needed. Which is the ultimate source of information? Are we supposed to just read the code? This probably deserves a thread on its own…

Add-ons use and modify arbitrary parts of Anki’s codebase. I do my best to avoid breaking things unnecessarily, but sometimes things break when I change something that I didn’t expect people to be using.

For many things, you do need to read Anki’s codebase to see what is available, but there is an example of updating a note type in the docs: https://addon-docs.ankiweb.net/#/getting-started?id=readingwriting-objects