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

24 lines
748 B
Python
Raw Normal View History

2021-09-26 19:02:25 +02:00
from typing import Dict
from characters.models import Character
2021-10-03 16:57:06 +02:00
from factions.models import Faction
2021-09-26 19:02:25 +02:00
from locations.models import Location
from loot.models import Loot
2021-10-03 16:57:06 +02:00
from notes.models import Note
2021-09-26 19:02:25 +02:00
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()
2021-10-03 16:57:06 +02:00
for faction in Faction.objects.all():
data[faction.name] = faction.get_absolute_url()
for note in Note.objects.all():
data[note.name] = note.get_absolute_url()
2021-09-26 19:02:25 +02:00
return data