1 | #### cursesite.portals.wow.profiles.models ####
|
---|
2 | #### not in INSTALLED_APPS for this site ####
|
---|
3 |
|
---|
4 | from cursesite.portals.wow.database.models import ChrClasses, ChrRaces, Item, Spell, FACTIONS, Talent, ItemRandomProperties
|
---|
5 | from cursesite.portals.wow.database.models import ITEM_SLOTS, SpellItemEnchantment, Quest, SkillLine, SkillLineCategory, Faction
|
---|
6 |
|
---|
7 | class Equipment(models.Model):
|
---|
8 | character = models.ForeignKey(Character, db_index=True, raw_id_admin=True)
|
---|
9 | slot = models.IntegerField(choices=ITEM_SLOTS, db_index=True)
|
---|
10 | item = models.ForeignKey(Item, db_index=True, raw_id_admin=True)
|
---|
11 |
|
---|
12 | #### cursesite.portals.lotro.database.models ####
|
---|
13 | #### listed in INSTALLED_APPS on this site ####
|
---|
14 |
|
---|
15 | class Item(models.Model):
|
---|
16 | name = models.CharField(maxlength=128)
|
---|
17 | category = models.ForeignKey(ItemType, db_index=True)
|
---|
18 |
|
---|
19 | #### the DB call and its output ####
|
---|
20 | equips = Equipment.objects.filter(character=char).select_related(fields=['item']).order_by('slot')
|
---|
21 | equips = equips.extra(
|
---|
22 | tables=['database_itemdisplayinfo'],
|
---|
23 | select={'icon': 'database_itemdisplayinfo.icon'},
|
---|
24 | where=['database_itemdisplayinfo.id = database_item.display']
|
---|
25 | )
|
---|
26 |
|
---|
27 | ['`wow_profiles_equipment`.`id`', '`wow_profiles_equipment`.`character_id`', '`wow_profiles_equipment`.`slot`', '`wow_profiles_equipment`.`item_id`', '`wow_profiles_equipment`.`prop_id`', '`wow_profiles_equipment`.`enchant_id`', '`wow_profiles_equipment`.`socket_1_id`', '`wow_profiles_equipment`.`socket_2_id`', '`wow_profiles_equipment`.`socket_3_id`', '`wow_profiles_equipment`.`socket_4_id`', '`lotro_database_item`.`id`', '`lotro_database_item`.`name`', '`lotro_database_item`.`category_id`', '`lotro_database_item`.`slot_id`', '`lotro_database_item`.`bind_type`', '`lotro_database_item`.`is_indestructable`', '`lotro_database_item`.`is_unique`', '`lotro_database_item`.`req_level`', '`lotro_database_item`.`sturdiness`', '`lotro_database_item`.`worth`', '`lotro_database_item`.`description`', '`lotro_database_item`.`armor`', '`lotro_database_item`.`damage_min`', '`lotro_database_item`.`damage_max`', '`lotro_database_item`.`weapon_speed`', '`lotro_database_item`.`durability`', '`lotro_database_item`.`effects`', '(database_itemdisplayinfo.icon) AS `icon`']
|
---|