1
0
Fork 0
mirror of https://github.com/Findus23/RPGnotes.git synced 2024-09-19 15:43:45 +02:00
RPGnotes/utils/urls.py

18 lines
498 B
Python
Raw Normal View History

2021-09-26 19:02:25 +02:00
from typing import Dict
from characters.models import Character
from locations.models import Location
from loot.models import Loot
def name2url() -> Dict[str, str]:
data = {}
for character in Character.objects.all():
data[character.firstname] = character.get_absolute_url()
for location in Location.objects.all():
data[location.name] = location.get_absolute_url()
for loot in Loot.objects.all():
data[loot.name] = loot.get_absolute_url()
return data