Commit a74db45dcd9d8b259fa32864fb5d464b232f4fcc

Authored by janek37
1 parent b60d44b3

wyświetlanie wzorów w nagłówkach tabelek

dictionary/models.py
... ... @@ -367,13 +367,15 @@ class Lexeme(Model):
367 367  
368 368 def inflection_tables(self, variant, qualifiers=None):
369 369 lips = self.lexemeinflectionpattern_set.order_by('index')
370   - ics = []
  370 + ics = {}
371 371 for lip in lips:
372 372 ic = lip.inflection_characteristic
373 373 if ic not in ics:
374   - ics.append(ic)
375   - return [(ic, self.inflection_table(variant, ic, qualifiers=qualifiers))
376   - for ic in ics]
  374 + ics[ic] = []
  375 + ics[ic].append(lip.pattern.name)
  376 + return [(ic, patterns,
  377 + self.inflection_table(variant, ic, qualifiers=qualifiers))
  378 + for ic, patterns in ics.iteritems()]
377 379  
378 380 def inflection_table(self, variant, inflection_characteristic,
379 381 qualifiers=None):
... ...
dictionary/templates/inflection_table.html
1 1 <table class='inflection-table'>
2 2 {% if tables|length > 1 %}
3   - <caption>{{ inflection_characteristic.symbol }}</caption>
  3 + <caption>
  4 + {{ inflection_characteristic.symbol }}: {{ patterns|join:" / " }}
  5 + </caption>
4 6 {% endif %}
5 7 {% for row in table %}
6 8 <tr>
... ...
dictionary/templates/inflection_tables.html
... ... @@ -40,7 +40,7 @@
40 40 </p>
41 41 <p class="separator"></p>
42 42 <div class="inflection-tables">
43   - {% for inflection_characteristic, table in tables %}
  43 + {% for inflection_characteristic, patterns, table in tables %}
44 44 <div class="inflection-table-container">
45 45 {% include "inflection_table.html" %}
46 46 </div>
... ...