#### cursesite.portals.wow.profiles.models #### #### not in INSTALLED_APPS for this site #### from cursesite.portals.wow.database.models import ChrClasses, ChrRaces, Item, Spell, FACTIONS, Talent, ItemRandomProperties from cursesite.portals.wow.database.models import ITEM_SLOTS, SpellItemEnchantment, Quest, SkillLine, SkillLineCategory, Faction class Equipment(models.Model): character = models.ForeignKey(Character, db_index=True, raw_id_admin=True) slot = models.IntegerField(choices=ITEM_SLOTS, db_index=True) item = models.ForeignKey(Item, db_index=True, raw_id_admin=True) #### cursesite.portals.lotro.database.models #### #### listed in INSTALLED_APPS on this site #### class Item(models.Model): name = models.CharField(maxlength=128) category = models.ForeignKey(ItemType, db_index=True) #### the DB call and its output #### equips = Equipment.objects.filter(character=char).select_related(fields=['item']).order_by('slot') equips = equips.extra( tables=['database_itemdisplayinfo'], select={'icon': 'database_itemdisplayinfo.icon'}, where=['database_itemdisplayinfo.id = database_item.display'] ) ['`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`']