equal
deleted
inserted
replaced
59 collection.models.addField(model, collection.models.newField('en')) |
59 collection.models.addField(model, collection.models.newField('en')) |
60 collection.models.addField(model, collection.models.newField('ru')) |
60 collection.models.addField(model, collection.models.newField('ru')) |
61 |
61 |
62 tmpl = collection.models.newTemplate('en -> ru') |
62 tmpl = collection.models.newTemplate('en -> ru') |
63 tmpl['qfmt'] = '<div class="from">{{en}}</div>' |
63 tmpl['qfmt'] = '<div class="from">{{en}}</div>' |
64 tmpl['afmt'] = '{{FrontSide}}\n\n<hr id=answer>\n\n{{ru}}' |
64 tmpl['afmt'] = '{{FrontSide}}<hr id=answer>{{ru}}' |
65 collection.models.addTemplate(model, tmpl) |
65 collection.models.addTemplate(model, tmpl) |
66 tmpl = collection.models.newTemplate('ru -> en') |
66 tmpl = collection.models.newTemplate('ru -> en') |
67 tmpl['qfmt'] = '{{ru}}' |
67 tmpl['qfmt'] = '{{ru}}' |
68 tmpl['afmt'] = '{{FrontSide}}\n\n<hr id=answer>\n\n<div class="from">{{en}}</div>' |
68 tmpl['afmt'] = '{{FrontSide}}<hr id=answer><div class="from">{{en}}</div>' |
69 collection.models.addTemplate(model, tmpl) |
69 collection.models.addTemplate(model, tmpl) |
70 |
70 |
71 # print(dir(model)) |
71 # print(dir(model)) |
72 # print(type(model)) |
72 # print(type(model)) |
73 # print(model) |
73 # print(model) |
87 # print(note._fmap) |
87 # print(note._fmap) |
88 # print(note) |
88 # print(note) |
89 |
89 |
90 |
90 |
91 note['en'] = "hello" |
91 note['en'] = "hello" |
92 note['ru'] = u"[heləʊ]\nint. привет" |
92 note['ru'] = u"[heləʊ] int. привет" |
93 note.guid = "enru_1" |
93 note.guid = "enru_1" |
94 collection.addNote(note) |
94 collection.addNote(note) |
95 # print(dir(note)) |
95 # print(dir(note)) |
96 |
96 |
97 note = collection.newNote() |
97 note = collection.newNote() |
98 note['en'] = "bye" |
98 note['en'] = "bye" |
99 note['ru'] = u"[baɪ]\nint. пока" |
99 note['ru'] = u"[baɪ] int. пока" |
100 note.guid = "enru_2" |
100 note.guid = "enru_2" |
101 collection.addNote(note) |
101 collection.addNote(note) |
102 |
102 |
103 # model.add(deck) |
103 # model.add(deck) |
104 # model.save() |
104 # model.save() |
123 |
123 |
124 collection.models.addField(model_irrverb, collection.models.newField('v1')) |
124 collection.models.addField(model_irrverb, collection.models.newField('v1')) |
125 collection.models.addField(model_irrverb, collection.models.newField('v2')) |
125 collection.models.addField(model_irrverb, collection.models.newField('v2')) |
126 collection.models.addField(model_irrverb, collection.models.newField('v3')) |
126 collection.models.addField(model_irrverb, collection.models.newField('v3')) |
127 |
127 |
128 ANSWER_MSG = '{{FrontSide}}<hr id=answer>{{v1}}\n{{v2}}\n{{v3}}' |
128 ANSWER_MSG = '{{FrontSide}}<hr id=answer>{{v1}}<br>{{v2}}<br>{{v3}}' |
129 tmpl = collection.models.newTemplate('v1') |
129 tmpl = collection.models.newTemplate('v1') |
130 tmpl['qfmt'] = '<div class="v1">{{v1}}</div>' |
130 tmpl['qfmt'] = '<div class="v1">{{v1}}</div>' |
131 tmpl['afmt'] = ANSWER_MSG |
131 tmpl['afmt'] = ANSWER_MSG |
132 collection.models.addTemplate(model_irrverb, tmpl) |
132 collection.models.addTemplate(model_irrverb, tmpl) |
133 |
133 |