Commit 1761122b6f20028cfdf0a828af641ea2db60df0a
1 parent
d48ead51
poprawki do generowania derywatów
Showing
4 changed files
with
450 additions
and
9 deletions
dictionary/auto_derivatives.py
... | ... | @@ -15,7 +15,7 @@ n2 = Gender.objects.get(symbol='n2') |
15 | 15 | NO_POPRZ = LexemeAttributeValue.objects.get( |
16 | 16 | value=u'nieobecna', attribute__name=u'forma poprz.') |
17 | 17 | NO_ZLOZ = LexemeAttributeValue.objects.get( |
18 | - value=u'nieobecna', attribute__name=u'forma poprz.') | |
18 | + value=u'nieobecna', attribute__name=u'forma złoż.') | |
19 | 19 | |
20 | 20 | def lexeme_derivatives(lexeme): |
21 | 21 | if lexeme.part_of_speech.symbol == 'v': |
... | ... | @@ -53,14 +53,16 @@ def lexeme_derivatives(lexeme): |
53 | 53 | |
54 | 54 | |
55 | 55 | def create_derivative(lexeme, part_of_speech, entry, pl=None): |
56 | - next_id = Lexeme.objects.aggregate(Max('id'))['id__max'] + 1 | |
56 | + next_id = Lexeme.all_objects.aggregate(Max('id'))['id__max'] + 1 | |
57 | 57 | der = Lexeme( |
58 | 58 | id=next_id, entry=entry, part_of_speech_id=part_of_speech, |
59 | - status=lexeme.status, owner_vocabulary=lexeme.owner_vocabulary) | |
59 | + status=lexeme.status, owner_vocabulary_id=lexeme.owner_vocabulary_id, | |
60 | + specialist=lexeme.specialist, | |
61 | + borrowing_source_id=lexeme.borrowing_source_id) | |
60 | 62 | der.fix_homonym_number() |
61 | 63 | der.save() |
62 | 64 | lexeme.owner_vocabulary.add_lexeme(der) |
63 | - lip = LexemeInflectionPattern(lexeme=der) | |
65 | + lip = LexemeInflectionPattern(lexeme=der, index=1) | |
64 | 66 | if part_of_speech in ('ppas', 'appas'): |
65 | 67 | # -ty/-ci |
66 | 68 | if entry.endswith('ty'): |
... | ... | @@ -84,15 +86,16 @@ def create_derivative(lexeme, part_of_speech, entry, pl=None): |
84 | 86 | lip.pattern = P0196 |
85 | 87 | lip.root = lip.get_root() |
86 | 88 | lip.save() |
87 | - for attr_val in lexeme.attributes_values(): | |
88 | - if attr_val.attribute.parts_of_speech.filter(symbol=part_of_speech): | |
89 | + for attr, attr_val in lexeme.attributes_values(): | |
90 | + if attr.parts_of_speech.filter(symbol=part_of_speech): | |
89 | 91 | attr_val.add_lexeme(der) |
90 | 92 | if part_of_speech in ('ppas', 'appas', 'pact'): |
91 | 93 | NO_POPRZ.add_lexeme(der) |
92 | 94 | NO_ZLOZ.add_lexeme(der) |
93 | 95 | for q in lexeme.qualifiers.all(): |
94 | - q.lexemes.add(der) | |
95 | - if lexeme.lexical_class_id == 'v': | |
96 | + der.qualifiers.add(q) | |
97 | + lc = lexeme.part_of_speech.lexical_class_id | |
98 | + if lc == 'v': | |
96 | 99 | cr_type = CrossReferenceType.objects.get( |
97 | 100 | symbol='ver' + part_of_speech, from_pos_id='v', |
98 | 101 | to_pos_id=part_of_speech) |
... | ... | @@ -103,3 +106,4 @@ def create_derivative(lexeme, part_of_speech, entry, pl=None): |
103 | 106 | to_pos_id='v') |
104 | 107 | CrossReference.objects.create( |
105 | 108 | from_lexeme=der, to_lexeme=lexeme, type=cr_type) |
109 | + # można kopiować kwalifikator odmieniasia (do odmieniasia czy leksemu?) | |
... | ... |
dictionary/management/commands/fix_homonym.py
... | ... | @@ -5,6 +5,20 @@ from django.db.models import Count |
5 | 5 | from common.util import no_history |
6 | 6 | from dictionary.models import Lexeme |
7 | 7 | |
8 | +MORFEUSZ_LETTERS = { | |
9 | + 'v': ['v', 'pred'], | |
10 | + 's': ['subst', 'osc', 'skrs'], | |
11 | + 'a': ['adj'], | |
12 | + 'd': ['adv', 'advndm'], | |
13 | + 'n': ['num'], | |
14 | + 'b': ['fraz'], | |
15 | + 'q': ['part'], | |
16 | + 'i': ['interj'], | |
17 | + 'o': ['ppron'], | |
18 | + 'p': ['prep'], | |
19 | + 'c': ['comp'], | |
20 | + 'j': ['conj'], | |
21 | +} | |
8 | 22 | |
9 | 23 | class Command(BaseCommand): |
10 | 24 | args = 'none' |
... | ... |
dictionary/migrations/0071_auto__add_homonymnumber__add_unique_homonymnumber_lexeme_variant.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | +from south.utils import datetime_utils as datetime | |
3 | +from south.db import db | |
4 | +from south.v2 import SchemaMigration | |
5 | +from django.db import models | |
6 | + | |
7 | + | |
8 | +class Migration(SchemaMigration): | |
9 | + | |
10 | + def forwards(self, orm): | |
11 | + # Adding model 'HomonymNumber' | |
12 | + db.create_table(u'dictionary_homonymnumber', ( | |
13 | + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | |
14 | + ('lexeme', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['dictionary.Lexeme'])), | |
15 | + ('variant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['dictionary.Variant'])), | |
16 | + ('number', self.gf('django.db.models.fields.IntegerField')()), | |
17 | + )) | |
18 | + db.send_create_signal(u'dictionary', ['HomonymNumber']) | |
19 | + | |
20 | + # Adding unique constraint on 'HomonymNumber', fields ['lexeme', 'variant'] | |
21 | + db.create_unique(u'dictionary_homonymnumber', ['lexeme_id', 'variant_id']) | |
22 | + | |
23 | + | |
24 | + def backwards(self, orm): | |
25 | + # Removing unique constraint on 'HomonymNumber', fields ['lexeme', 'variant'] | |
26 | + db.delete_unique(u'dictionary_homonymnumber', ['lexeme_id', 'variant_id']) | |
27 | + | |
28 | + # Deleting model 'HomonymNumber' | |
29 | + db.delete_table(u'dictionary_homonymnumber') | |
30 | + | |
31 | + | |
32 | + models = { | |
33 | + u'auth.group': { | |
34 | + 'Meta': {'object_name': 'Group'}, | |
35 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
36 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), | |
37 | + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) | |
38 | + }, | |
39 | + u'auth.permission': { | |
40 | + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, | |
41 | + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | |
42 | + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), | |
43 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
44 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | |
45 | + }, | |
46 | + u'auth.user': { | |
47 | + 'Meta': {'object_name': 'User'}, | |
48 | + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | |
49 | + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), | |
50 | + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | |
51 | + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), | |
52 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
53 | + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | |
54 | + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
55 | + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
56 | + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | |
57 | + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | |
58 | + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), | |
59 | + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), | |
60 | + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) | |
61 | + }, | |
62 | + u'contenttypes.contenttype': { | |
63 | + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, | |
64 | + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | |
65 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
66 | + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | |
67 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) | |
68 | + }, | |
69 | + u'dictionary.baseformlabel': { | |
70 | + 'Meta': {'ordering': "['index']", 'unique_together': "(['symbol', 'lexical_class'],)", 'object_name': 'BaseFormLabel', 'db_table': "'efobazy'"}, | |
71 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
72 | + 'index': ('django.db.models.fields.IntegerField', [], {}), | |
73 | + 'lexical_class': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.LexicalClass']"}), | |
74 | + 'symbol': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_column': "'efobaz'", 'blank': 'True'}) | |
75 | + }, | |
76 | + u'dictionary.borrowingsource': { | |
77 | + 'Meta': {'object_name': 'BorrowingSource'}, | |
78 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
79 | + 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}) | |
80 | + }, | |
81 | + u'dictionary.classification': { | |
82 | + 'Meta': {'object_name': 'Classification', 'db_table': "'klasyfikacje'"}, | |
83 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
84 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_column': "'nazwa'"}), | |
85 | + 'parts_of_speech': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PartOfSpeech']", 'symmetrical': 'False'}) | |
86 | + }, | |
87 | + u'dictionary.classificationvalue': { | |
88 | + 'Meta': {'ordering': "['label']", 'object_name': 'ClassificationValue', 'db_table': "'wartosci_klasyfikacji'"}, | |
89 | + 'classification': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'values'", 'db_column': "'klas_id'", 'to': u"orm['dictionary.Classification']"}), | |
90 | + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_column': "'usunieta'"}), | |
91 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
92 | + 'label': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_column': "'nazwa'"}), | |
93 | + 'lexemes': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Lexeme']", 'symmetrical': 'False', 'through': u"orm['dictionary.LexemeCV']", 'blank': 'True'}), | |
94 | + 'parent_node': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'child_nodes'", 'null': 'True', 'db_column': "'rodzic'", 'to': u"orm['dictionary.ClassificationValue']"}) | |
95 | + }, | |
96 | + u'dictionary.crossreference': { | |
97 | + 'Meta': {'object_name': 'CrossReference', 'db_table': "'odsylacze'"}, | |
98 | + 'from_lexeme': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'refs_to'", 'db_column': "'l_id_od'", 'to': u"orm['dictionary.Lexeme']"}), | |
99 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
100 | + 'to_lexeme': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'refs_from'", 'db_column': "'l_id_do'", 'to': u"orm['dictionary.Lexeme']"}), | |
101 | + 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.CrossReferenceType']", 'db_column': "'typods_id'"}) | |
102 | + }, | |
103 | + u'dictionary.crossreferencetype': { | |
104 | + 'Meta': {'object_name': 'CrossReferenceType', 'db_table': "'typyodsylaczy'"}, | |
105 | + 'desc': ('django.db.models.fields.CharField', [], {'max_length': '40', 'db_column': "'naglowek'"}), | |
106 | + 'from_pos': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'crtype_to'", 'db_column': "'pos1'", 'to': u"orm['dictionary.PartOfSpeech']"}), | |
107 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
108 | + 'index': ('django.db.models.fields.IntegerField', [], {'db_column': "'kolejnosc'"}), | |
109 | + 'symbol': ('django.db.models.fields.CharField', [], {'max_length': '10', 'db_column': "'typods'"}), | |
110 | + 'to_pos': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'crtype_from'", 'db_column': "'pos2'", 'to': u"orm['dictionary.PartOfSpeech']"}) | |
111 | + }, | |
112 | + u'dictionary.ending': { | |
113 | + 'Meta': {'ordering': "['index']", 'unique_together': "(('pattern', 'base_form_label', 'index'),)", 'object_name': 'Ending', 'db_table': "'zakonczenia'"}, | |
114 | + 'base_form_label': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BaseFormLabel']", 'db_column': "'efobaz'"}), | |
115 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
116 | + 'index': ('django.db.models.fields.IntegerField', [], {'db_column': "'zind'"}), | |
117 | + 'pattern': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'endings'", 'db_column': "'w_id'", 'to': u"orm['dictionary.Pattern']"}), | |
118 | + 'qualifiers': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Qualifier']", 'symmetrical': 'False', 'db_table': "'kwalifikatory_zakonczen'", 'blank': 'True'}), | |
119 | + 'string': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_column': "'zak'", 'blank': 'True'}) | |
120 | + }, | |
121 | + u'dictionary.exportcell': { | |
122 | + 'Meta': {'object_name': 'ExportCell'}, | |
123 | + 'attribute_values': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.LexemeAttributeValue']", 'symmetrical': 'False'}), | |
124 | + 'base_form_label': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BaseFormLabel']"}), | |
125 | + 'genders': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Gender']", 'symmetrical': 'False'}), | |
126 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
127 | + 'pattern_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PatternType']", 'symmetrical': 'False'}), | |
128 | + 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}), | |
129 | + 'suffix': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}), | |
130 | + 'table_template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'export_cells'", 'to': u"orm['dictionary.TableTemplate']"}), | |
131 | + 'tag_template': ('django.db.models.fields.TextField', [], {}) | |
132 | + }, | |
133 | + u'dictionary.gender': { | |
134 | + 'Meta': {'object_name': 'Gender'}, | |
135 | + 'basic_form_label': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BaseFormLabel']"}), | |
136 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
137 | + 'symbol': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '4'}) | |
138 | + }, | |
139 | + u'dictionary.history': { | |
140 | + 'Meta': {'object_name': 'History', 'db_table': "'history'"}, | |
141 | + 'column_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_column': "'column_name_'", 'blank': 'True'}), | |
142 | + 'column_ord': ('django.db.models.fields.IntegerField', [], {'db_column': "'ordinal_position_of_column_'"}), | |
143 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
144 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']", 'null': 'True', 'db_column': "'lexeme_id_'", 'blank': 'True'}), | |
145 | + 'new_value': ('django.db.models.fields.TextField', [], {'db_column': "'new_value_'", 'blank': 'True'}), | |
146 | + 'old_value': ('django.db.models.fields.TextField', [], {'db_column': "'old_value_'", 'blank': 'True'}), | |
147 | + 'operation': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_column': "'operation_'"}), | |
148 | + 'pattern': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Pattern']", 'null': 'True', 'db_column': "'pattern_id_'", 'blank': 'True'}), | |
149 | + 'row_id': ('django.db.models.fields.IntegerField', [], {'db_column': "'id_'"}), | |
150 | + 'table_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_column': "'table_name_'"}), | |
151 | + 'table_oid': ('django.db.models.fields.IntegerField', [], {'db_column': "'table_oid_'"}), | |
152 | + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_column': "'timestamp_'"}), | |
153 | + 'transaction_began': ('django.db.models.fields.DateTimeField', [], {'db_column': "'transaction_began_'"}), | |
154 | + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'db_column': "'user_id_'"}) | |
155 | + }, | |
156 | + u'dictionary.homonymnumber': { | |
157 | + 'Meta': {'unique_together': "(['lexeme', 'variant'],)", 'object_name': 'HomonymNumber'}, | |
158 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
159 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']"}), | |
160 | + 'number': ('django.db.models.fields.IntegerField', [], {}), | |
161 | + 'variant': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Variant']"}) | |
162 | + }, | |
163 | + u'dictionary.inflectioncharacteristic': { | |
164 | + 'Meta': {'unique_together': "(('symbol', 'part_of_speech'),)", 'object_name': 'InflectionCharacteristic', 'db_table': "'charfle'"}, | |
165 | + 'basic_form_label': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BaseFormLabel']", 'db_column': "'efobaz'"}), | |
166 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
167 | + 'part_of_speech': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.PartOfSpeech']", 'db_column': "'pos'"}), | |
168 | + 'symbol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_column': "'charfl'", 'blank': 'True'}) | |
169 | + }, | |
170 | + u'dictionary.inputform': { | |
171 | + 'Meta': {'object_name': 'InputForm'}, | |
172 | + 'form': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}), | |
173 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
174 | + 'input_lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.InputLexeme']"}) | |
175 | + }, | |
176 | + u'dictionary.inputlexeme': { | |
177 | + 'Meta': {'object_name': 'InputLexeme'}, | |
178 | + 'entry': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}), | |
179 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) | |
180 | + }, | |
181 | + u'dictionary.lexeme': { | |
182 | + 'Meta': {'object_name': 'Lexeme', 'db_table': "'leksemy'"}, | |
183 | + 'borrowing_source': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BorrowingSource']", 'null': 'True', 'blank': 'True'}), | |
184 | + 'comment': ('django.db.models.fields.TextField', [], {'db_column': "'komentarz'", 'blank': 'True'}), | |
185 | + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_column': "'usuniety'"}), | |
186 | + 'entry': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'db_column': "'haslo'", 'blank': 'True'}), | |
187 | + 'entry_suffix': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_column': "'haslosuf'", 'blank': 'True'}), | |
188 | + 'extended_note': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | |
189 | + 'gloss': ('django.db.models.fields.TextField', [], {'db_column': "'glosa'", 'blank': 'True'}), | |
190 | + 'homonym_number': ('django.db.models.fields.IntegerField', [], {'default': '1', 'db_column': "'hom'"}), | |
191 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
192 | + 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_column': "'data_modyfikacji'", 'blank': 'True'}), | |
193 | + 'note': ('django.db.models.fields.TextField', [], {'db_column': "'nota'", 'blank': 'True'}), | |
194 | + 'owner_vocabulary': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'owned_lexemes'", 'db_column': "'slownik'", 'to': u"orm['dictionary.Vocabulary']"}), | |
195 | + 'part_of_speech': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.PartOfSpeech']", 'db_column': "'pos'"}), | |
196 | + 'patterns': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Pattern']", 'through': u"orm['dictionary.LexemeInflectionPattern']", 'symmetrical': 'False'}), | |
197 | + 'pronunciation': ('django.db.models.fields.TextField', [], {'db_column': "'wymowa'", 'blank': 'True'}), | |
198 | + 'qualifiers': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Qualifier']", 'symmetrical': 'False', 'db_table': "'kwalifikatory_leksemow'", 'blank': 'True'}), | |
199 | + 'qualifiers_cache': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'all_lexemes'", 'symmetrical': 'False', 'through': u"orm['dictionary.LexemeFormQualifier']", 'to': u"orm['dictionary.Qualifier']"}), | |
200 | + 'qualifiers_dor': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | |
201 | + 'qualifiers_scope': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | |
202 | + 'qualifiers_style': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | |
203 | + 'responsible': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'db_column': "'odpowiedzialny'", 'blank': 'True'}), | |
204 | + 'source': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_column': "'zrodlo'", 'blank': 'True'}), | |
205 | + 'source_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), | |
206 | + 'specialist': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
207 | + 'status': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_column': "'status'"}), | |
208 | + 'valence': ('django.db.models.fields.TextField', [], {'blank': 'True'}) | |
209 | + }, | |
210 | + u'dictionary.lexemeassociation': { | |
211 | + 'Meta': {'unique_together': "(['lexeme', 'vocabulary'],)", 'object_name': 'LexemeAssociation', 'db_table': "'leksemy_w_slownikach'"}, | |
212 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
213 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']", 'db_column': "'l_id'"}), | |
214 | + 'vocabulary': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Vocabulary']", 'db_column': "'slownik'"}) | |
215 | + }, | |
216 | + u'dictionary.lexemeattribute': { | |
217 | + 'Meta': {'object_name': 'LexemeAttribute'}, | |
218 | + 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
219 | + 'genders': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Gender']", 'symmetrical': 'False', 'blank': 'True'}), | |
220 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
221 | + 'multiple': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
222 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}), | |
223 | + 'parts_of_speech': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PartOfSpeech']", 'symmetrical': 'False'}), | |
224 | + 'required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
225 | + 'takes_gender': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) | |
226 | + }, | |
227 | + u'dictionary.lexemeattributevalue': { | |
228 | + 'Meta': {'ordering': "['value']", 'object_name': 'LexemeAttributeValue'}, | |
229 | + 'attribute': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'values'", 'to': u"orm['dictionary.LexemeAttribute']"}), | |
230 | + 'display_value': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}), | |
231 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
232 | + 'lexemes': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Lexeme']", 'symmetrical': 'False', 'through': u"orm['dictionary.LexemeAV']", 'blank': 'True'}), | |
233 | + 'value': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}) | |
234 | + }, | |
235 | + u'dictionary.lexemeav': { | |
236 | + 'Meta': {'unique_together': "(['lexeme', 'attribute_value'],)", 'object_name': 'LexemeAV'}, | |
237 | + 'attribute_value': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.LexemeAttributeValue']"}), | |
238 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
239 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']"}) | |
240 | + }, | |
241 | + u'dictionary.lexemecv': { | |
242 | + 'Meta': {'unique_together': "(['lexeme', 'classification_value'],)", 'object_name': 'LexemeCV'}, | |
243 | + 'classification_value': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.ClassificationValue']"}), | |
244 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
245 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']"}) | |
246 | + }, | |
247 | + u'dictionary.lexemeform': { | |
248 | + 'Meta': {'object_name': 'LexemeForm'}, | |
249 | + 'form': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), | |
250 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
251 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']"}) | |
252 | + }, | |
253 | + u'dictionary.lexemeformqualifier': { | |
254 | + 'Meta': {'object_name': 'LexemeFormQualifier'}, | |
255 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
256 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']"}), | |
257 | + 'qualifier': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Qualifier']"}) | |
258 | + }, | |
259 | + u'dictionary.lexemeinflectionpattern': { | |
260 | + 'Meta': {'ordering': "['index']", 'unique_together': "(('lexeme', 'index'),)", 'object_name': 'LexemeInflectionPattern', 'db_table': "'odmieniasie'"}, | |
261 | + 'gender': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Gender']", 'null': 'True', 'blank': 'True'}), | |
262 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
263 | + 'index': ('django.db.models.fields.IntegerField', [], {'db_column': "'oind'"}), | |
264 | + 'lexeme': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Lexeme']", 'db_column': "'l_id'"}), | |
265 | + 'pattern': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Pattern']", 'db_column': "'w_id'"}), | |
266 | + 'qualifiers': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Qualifier']", 'symmetrical': 'False', 'db_table': "'kwalifikatory_odmieniasiow'", 'blank': 'True'}), | |
267 | + 'root': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_column': "'rdzen'"}) | |
268 | + }, | |
269 | + u'dictionary.lexicalclass': { | |
270 | + 'Meta': {'object_name': 'LexicalClass', 'db_table': "'czescimowy'"}, | |
271 | + 'symbol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'primary_key': 'True', 'db_column': "'czm'"}) | |
272 | + }, | |
273 | + u'dictionary.paradygmatywsjp': { | |
274 | + 'Meta': {'object_name': 'ParadygmatyWSJP', 'db_table': "'paradygmatywsjp'"}, | |
275 | + 'charfl': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.InflectionCharacteristic']", 'db_column': "'charfl'"}), | |
276 | + 'col': ('django.db.models.fields.IntegerField', [], {}), | |
277 | + 'colspan': ('django.db.models.fields.IntegerField', [], {}), | |
278 | + 'efobaz': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BaseFormLabel']", 'db_column': "'efobaz'"}), | |
279 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
280 | + 'kskl': ('django.db.models.fields.IntegerField', [], {}), | |
281 | + 'morf': ('django.db.models.fields.TextField', [], {}), | |
282 | + 'podparad': ('django.db.models.fields.CharField', [], {'max_length': '4', 'blank': 'True'}), | |
283 | + 'pref': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}), | |
284 | + 'row': ('django.db.models.fields.IntegerField', [], {}), | |
285 | + 'rowspan': ('django.db.models.fields.IntegerField', [], {}), | |
286 | + 'suf': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}), | |
287 | + 'typr': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.PatternType']", 'db_column': "'typr'"}), | |
288 | + 'wariant': ('django.db.models.fields.CharField', [], {'max_length': '4'}) | |
289 | + }, | |
290 | + u'dictionary.partofspeech': { | |
291 | + 'Meta': {'ordering': "['index']", 'object_name': 'PartOfSpeech', 'db_table': "'klasygramatyczne'"}, | |
292 | + 'color_scheme': ('django.db.models.fields.IntegerField', [], {}), | |
293 | + 'full_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_column': "'nazwa'"}), | |
294 | + 'index': ('django.db.models.fields.IntegerField', [], {}), | |
295 | + 'lexical_class': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.LexicalClass']", 'db_column': "'czm'"}), | |
296 | + 'symbol': ('django.db.models.fields.CharField', [], {'max_length': '16', 'primary_key': 'True', 'db_column': "'pos'"}) | |
297 | + }, | |
298 | + u'dictionary.pattern': { | |
299 | + 'Meta': {'ordering': "['name']", 'object_name': 'Pattern', 'db_table': "'wzory'"}, | |
300 | + 'basic_form_ending': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_column': "'zakp'", 'blank': 'True'}), | |
301 | + 'comment': ('django.db.models.fields.TextField', [], {'db_column': "'komentarz'", 'blank': 'True'}), | |
302 | + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
303 | + 'example': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_column': "'przyklad'", 'blank': 'True'}), | |
304 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
305 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_column': "'w_id'"}), | |
306 | + 'status': ('django.db.models.fields.CharField', [], {'max_length': '8'}), | |
307 | + 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.PatternType']", 'db_column': "'typ'"}) | |
308 | + }, | |
309 | + u'dictionary.patterntype': { | |
310 | + 'Meta': {'ordering': "['symbol']", 'object_name': 'PatternType', 'db_table': "'typywzorow'"}, | |
311 | + 'base_form_labels': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.BaseFormLabel']", 'symmetrical': 'False'}), | |
312 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
313 | + 'lexical_class': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.LexicalClass']", 'db_column': "'czm'"}), | |
314 | + 'symbol': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_column': "'wtyp'", 'blank': 'True'}) | |
315 | + }, | |
316 | + u'dictionary.qualifier': { | |
317 | + 'Meta': {'ordering': "['label']", 'unique_together': "(('label', 'vocabulary'),)", 'object_name': 'Qualifier', 'db_table': "'kwalifikatory'"}, | |
318 | + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_column': "'usuniety'"}), | |
319 | + 'exclusion_class': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.QualifierExclusionClass']", 'null': 'True', 'db_column': "'klasa'", 'blank': 'True'}), | |
320 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
321 | + 'label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_column': "'kwal'"}), | |
322 | + 'type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), | |
323 | + 'vocabulary': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'qualifiers'", 'db_column': "'slownik'", 'to': u"orm['dictionary.Vocabulary']"}) | |
324 | + }, | |
325 | + u'dictionary.qualifierexclusionclass': { | |
326 | + 'Meta': {'object_name': 'QualifierExclusionClass', 'db_table': "'klasy_wykluczania'"}, | |
327 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
328 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_column': "'nazwa'"}), | |
329 | + 'vocabulary': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Vocabulary']", 'db_column': "'slownik'"}) | |
330 | + }, | |
331 | + u'dictionary.savedexportdata': { | |
332 | + 'Meta': {'object_name': 'SavedExportData'}, | |
333 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
334 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}), | |
335 | + 'serialized_data': ('django.db.models.fields.TextField', [], {}) | |
336 | + }, | |
337 | + u'dictionary.savedfilter': { | |
338 | + 'Meta': {'unique_together': "(('name', 'user'),)", 'object_name': 'SavedFilter'}, | |
339 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
340 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), | |
341 | + 'serialized_filter': ('django.db.models.fields.TextField', [], {}), | |
342 | + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) | |
343 | + }, | |
344 | + u'dictionary.tablecell': { | |
345 | + 'Meta': {'object_name': 'TableCell'}, | |
346 | + 'attribute_values': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.LexemeAttributeValue']", 'symmetrical': 'False'}), | |
347 | + 'base_form_label': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.BaseFormLabel']"}), | |
348 | + 'col': ('django.db.models.fields.IntegerField', [], {}), | |
349 | + 'colspan': ('django.db.models.fields.IntegerField', [], {}), | |
350 | + 'genders': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Gender']", 'symmetrical': 'False'}), | |
351 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
352 | + 'index': ('django.db.models.fields.IntegerField', [], {}), | |
353 | + 'pattern_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PatternType']", 'symmetrical': 'False'}), | |
354 | + 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}), | |
355 | + 'row': ('django.db.models.fields.IntegerField', [], {}), | |
356 | + 'rowspan': ('django.db.models.fields.IntegerField', [], {}), | |
357 | + 'suffix': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}), | |
358 | + 'table_template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'table_cells'", 'to': u"orm['dictionary.TableTemplate']"}) | |
359 | + }, | |
360 | + u'dictionary.tableheader': { | |
361 | + 'Meta': {'object_name': 'TableHeader'}, | |
362 | + 'attribute_values': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.LexemeAttributeValue']", 'symmetrical': 'False'}), | |
363 | + 'col': ('django.db.models.fields.IntegerField', [], {}), | |
364 | + 'colspan': ('django.db.models.fields.IntegerField', [], {}), | |
365 | + 'css_class': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_column': "'styl'"}), | |
366 | + 'genders': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.Gender']", 'symmetrical': 'False'}), | |
367 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
368 | + 'label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_column': "'nagl'", 'blank': 'True'}), | |
369 | + 'pattern_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PatternType']", 'symmetrical': 'False'}), | |
370 | + 'row': ('django.db.models.fields.IntegerField', [], {}), | |
371 | + 'rowspan': ('django.db.models.fields.IntegerField', [], {}), | |
372 | + 'table_template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'headers'", 'to': u"orm['dictionary.TableTemplate']"}) | |
373 | + }, | |
374 | + u'dictionary.tabletemplate': { | |
375 | + 'Meta': {'object_name': 'TableTemplate'}, | |
376 | + 'attribute_values': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.LexemeAttributeValue']", 'symmetrical': 'False'}), | |
377 | + 'attributes': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.LexemeAttribute']", 'symmetrical': 'False'}), | |
378 | + 'cell_attributes': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'templates'", 'symmetrical': 'False', 'to': u"orm['dictionary.LexemeAttribute']"}), | |
379 | + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |
380 | + 'name': ('django.db.models.fields.TextField', [], {}), | |
381 | + 'parts_of_speech': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PartOfSpeech']", 'symmetrical': 'False'}), | |
382 | + 'pattern_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['dictionary.PatternType']", 'symmetrical': 'False'}), | |
383 | + 'takes_gender': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |
384 | + 'variant': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['dictionary.Variant']"}) | |
385 | + }, | |
386 | + u'dictionary.variant': { | |
387 | + 'Meta': {'object_name': 'Variant', 'db_table': "'warianty'"}, | |
388 | + 'id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'primary_key': 'True', 'db_column': "'wariant'"}), | |
389 | + 'type': ('django.db.models.fields.CharField', [], {'max_length': '10'}) | |
390 | + }, | |
391 | + u'dictionary.vocabulary': { | |
392 | + 'Meta': {'ordering': "['id']", 'object_name': 'Vocabulary', 'db_table': "'slowniki'"}, | |
393 | + 'classifications': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'vocabularies'", 'blank': 'True', 'to': u"orm['dictionary.Classification']"}), | |
394 | + 'editors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'editable_vocabularies'", 'blank': 'True', 'to': u"orm['auth.User']"}), | |
395 | + 'id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True', 'db_column': "'slownik'"}), | |
396 | + 'lexemes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'vocabularies'", 'blank': 'True', 'through': u"orm['dictionary.LexemeAssociation']", 'to': u"orm['dictionary.Lexeme']"}), | |
397 | + 'managers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'managed_vocabularies'", 'blank': 'True', 'to': u"orm['auth.User']"}), | |
398 | + 'viewers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'visible_vocabularies'", 'blank': 'True', 'to': u"orm['auth.User']"}) | |
399 | + } | |
400 | + } | |
401 | + | |
402 | + complete_apps = ['dictionary'] | |
0 | 403 | \ No newline at end of file |
... | ... |
dictionary/models.py
... | ... | @@ -432,6 +432,7 @@ class Lexeme(Model): |
432 | 432 | |
433 | 433 | entry = CharField(max_length=64, db_column='haslo', db_index=True, |
434 | 434 | verbose_name=u'hasło', blank=True) # dla nowo utworzonych |
435 | + # id w źródłowej bazie | |
435 | 436 | source_id = IntegerField(blank=True, null=True) |
436 | 437 | # pozostałość historyczna: |
437 | 438 | entry_suffix = CharField(blank=True, max_length=16, db_column='haslosuf', |
... | ... | @@ -588,6 +589,13 @@ class Lexeme(Model): |
588 | 589 | self.homonym_number = i |
589 | 590 | break |
590 | 591 | |
592 | + def get_variant_homonym(self, variant_id): | |
593 | + hom = HomonymNumber.objects.filter(lexeme=self, variant_id=variant_id) | |
594 | + if hom: | |
595 | + return hom.get().number | |
596 | + else: | |
597 | + return None | |
598 | + | |
591 | 599 | def attributes(self, part_of_speech=None, genders=None): |
592 | 600 | pos = part_of_speech or self.part_of_speech |
593 | 601 | if genders is None and pos.lexical_class_id == 'subst': |
... | ... | @@ -629,6 +637,7 @@ class Lexeme(Model): |
629 | 637 | def undelete(self): |
630 | 638 | no_history() |
631 | 639 | self.deleted = False |
640 | + self.fix_homonym_number() | |
632 | 641 | self.save() |
633 | 642 | self.history_set.get(column_name='usuniety').delete() |
634 | 643 | |
... | ... | @@ -1041,7 +1050,8 @@ class TableTemplate(Model): |
1041 | 1050 | def filter_cells_attr(self, cells, attr_vals): |
1042 | 1051 | for attr in self.cell_attributes.all(): |
1043 | 1052 | attr_val = [a for a in attr_vals if a.attribute == attr] |
1044 | - assert len(attr_val) == 1 | |
1053 | + if len(attr_val) != 1: | |
1054 | + return None | |
1045 | 1055 | cells = cells.filter(attribute_values=attr_val[0]) |
1046 | 1056 | return cells |
1047 | 1057 | |
... | ... | @@ -1079,6 +1089,8 @@ class TableTemplate(Model): |
1079 | 1089 | lip_qualifiers=None, numbers=False, span=False): |
1080 | 1090 | table_cells = self.filter_table_cells(pattern_type, gender, attr_vals) |
1081 | 1091 | headers = self.filter_table_headers(pattern_type, gender, attr_vals) |
1092 | + if table_cells is None or headers is None: | |
1093 | + return [] | |
1082 | 1094 | rows = set() |
1083 | 1095 | last_col = 0 |
1084 | 1096 | for table_cell in table_cells: |
... | ... | @@ -1286,6 +1298,15 @@ class ParadygmatyWSJP(Model): |
1286 | 1298 | db_table = 'paradygmatywsjp' |
1287 | 1299 | |
1288 | 1300 | |
1301 | +class HomonymNumber(Model): | |
1302 | + lexeme = ForeignKey(Lexeme) | |
1303 | + variant = ForeignKey(Variant) | |
1304 | + number = IntegerField() | |
1305 | + | |
1306 | + class Meta: | |
1307 | + unique_together = ['lexeme', 'variant'] | |
1308 | + | |
1309 | + | |
1289 | 1310 | class LexemeForm(Model): |
1290 | 1311 | lexeme = ForeignKey(Lexeme) |
1291 | 1312 | form = CharField(max_length=128, db_index=True) |
... | ... |