So Im literally going crazy trying to understand why I can't retrieve an individual value from a dictionary that's being passed to my template.
def createCharacterSkills(request):
user = request.user
if user.is_authenticated and request.method=="GET":
characterid = request.session["characterid"]
print(characterid)
characterrecord = character.objects.filter(pk=characterid)
print(characterrecord.values())
return render(request, "characters/createcharacter2.html", {'characterrecord':characterrecord})
Is what I am passing to my template. Below is the relevant code in my template:
<b>Name: </b>{{ characterrecord.values }} <br>
<b>Player Reference: </b>{{ characterrecord.id }}<br>
The characterrecord.values is working correctly and returning the whole dictionary as expected.
<QuerySet [{'id': 48, 'player_id': 1, 'character_name': 'Avalon', 'character_race': 'Dwarf', 'character_faction': 'Jhereg', 'character_group': 'Moredhel', 'ambidexterity': 0, 'dagger': 0, 'one_handed_weapon': 0, 'pole_arms': 0, 'projectile_weapons': 0, 'shield': 0, 'two_handed_weapons': 0, 'thrown_weapons': 0, 'wear_light_armour': 0, 'wear_medium_armour': 0, 'wear_heavy_armour': 0, 'wear_extra_heavy_armour': 0, 'body_development': 0, 'literacy': 0, 'surgeon': 0, 'numeracy': 0, 'alchemist': 0, 'crafting': 0, 'evaluate': 0, 'ranger_1': 0, 'ranger_2': 0, 'make_and_read_maps': 0, 'recongnise_forgery': 0, 'poison_lore_1': 0, 'posion_Lore_2': 0, 'potion_lore_1': 0, 'potion_lore_2': 0, 'ritual_contribute': 0, 'ritual_magic': 0, 'invocation': 0, 'corporeal_1': 0, 'corporeal_2': 0, 'mage_1': 0, 'mage_2': 0, 'shamanism_1': 0, 'shamanism_2': 0, 'forage': 0, 'meditation': 0, 'vet_ritual_magic': 0, 'vet_ritual_contribute': 0, 'chameleon': 0, 'fearless': 0, 'natural_armour': 0, 'sense_magic': 0, 'track': 0, 'intuition': 0, 'poison_resistance': 0, 'resist_magic': 0, 'sense_trap': 0, 'iron_will': 0, 'resist_disease': 0, 'discern_truth': 0, 'scrounge': 0, 'tricks_of_the_trade': 0, 'versatility': 0, 'regeneration': 0, 'extra_body_dev': 0}]>
However when I try to address and individual key in the dictionary I have no value in the template. I have done this numerous times in the past with no issue so I am at a loss as to why I am having this issue now.
Any help would be greatly appreciated.