def army_edition(self, army=None, special_message=''):
        if (army == None):
            army_id = self.request.matchdict.get('id', 0)
            army = Army.get_by_id(army_id)
        
        dice_list = [{'id': dice.id, 'name': dice.name, 'picture': dice.template.picture} for dice in army.components]

        template_list = []
        for race in Race.get_all():
            if race.break_by_color:
                for color in Element.get_all():
                    sub_race = []
                    for dice in race.dices:
                        if color in dice.elements:
                            sub_race.append(dice)
                    if sub_race != []:
                        template_list.append((color.name+' '+race.name, color.element_short_name+' '+race.tag, race.color, [{'id': dice.id, 'name': dice.name, 'picture': dice.picture} for dice in sub_race]))
            else:
                template_list.append((race.name, race.tag, race.color, [{'id': dice_template.id, 'name': dice_template.name, 'picture': dice_template.picture} for dice_template in race.dices]))

        return {'special_message': special_message, 'races': template_list, 'dices': dice_list, 'army_id': army.id}
from business.dice.dice_template import DiceTemplate

health_conversion = {
    1: 'UC',
    2: 'UC',
    3: 'R ',
    4: 'M '
}

result_consistency = {}
result_concentration = {}

result_consistency_by_unit = {}
result_concentration_by_unit = {}

for race in Race.get_all():
    result_consistency[race.id] = {
        'UC': {'Melee': 0, 'Missile': 0, 'Maneuver': 0, 'Save': 0, 'Magic': 0},
        'R ': {'Melee': 0, 'Missile': 0, 'Maneuver': 0, 'Save': 0, 'Magic': 0},
        'M ': {'Melee': 0, 'Missile': 0, 'Maneuver': 0, 'Save': 0, 'Magic': 0},
    }
    result_concentration[race.id] = {
        'UC': {'Melee': 0, 'Missile': 0, 'Maneuver': 0, 'Save': 0, 'Magic': 0},
        'R ': {'Melee': 0, 'Missile': 0, 'Maneuver': 0, 'Save': 0, 'Magic': 0},
        'M ': {'Melee': 0, 'Missile': 0, 'Maneuver': 0, 'Save': 0, 'Magic': 0},
    }
    result_consistency_by_unit[race.id] = {}
    result_concentration_by_unit[race.id] = {}

    for dice_template in race.dices:
        melee_amount = 0
    2: DiceType.get_by_id(2),
    3: DiceType.get_by_id(3),
    4: DiceType.get_by_id(4),
}

conversion_item_type = {
    1: DiceType.get_by_id(5),
    2: DiceType.get_by_id(6),
    3: DiceType.get_by_id(7),
    4: DiceType.get_by_id(8),
}
medallion_type = DiceType.get_by_id(9)

from business.race import Race
conversion_race = {
    'CORALELF': Race.get_by_id(1),
    'DWARF': Race.get_by_id(3),
    'GOBLIN': Race.get_by_id(4),
    'LAVAELF': Race.get_by_id(2),
    'AMAZON': Race.get_by_id(5),
    'FIREWALKER': Race.get_by_id(6),
    'UNDEAD': Race.get_by_id(7),
    'FERAL': Race.get_by_id(8),
    'SWAMPSTALKER': Race.get_by_id(9),
    'SCALDER': Race.get_by_id(11),
    'FROSTWING': Race.get_by_id(10),
    'TREEFOLK': Race.get_by_id(12),
    #All color of eldarim are eldarim
    'ELDARIM_WATER': Race.get_by_id(13),
    'ELDARIM_AIR': Race.get_by_id(13),
    'ELDARIM_FIRE': Race.get_by_id(13),