Skip to content
Snippets Groups Projects
Verified Commit d5bb93a0 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: update utils Host -> Profile

parent 9f310592
No related branches found
No related tags found
No related merge requests found
...@@ -30,9 +30,9 @@ from django.utils import timezone ...@@ -30,9 +30,9 @@ from django.utils import timezone
from program.typing import Link from program.typing import Link
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from program.models import Host, HostLink, Note, NoteLink, Show, ShowLink from program.models import Note, NoteLink, Profile, ProfileLink, Show, ShowLink
else: else:
from program.models import Host, HostLink, Note, NoteLink, Show, ShowLink from program.models import Note, NoteLink, Profile, ProfileLink, Show, ShowLink
def parse_datetime(date_string: str | None) -> datetime | None: def parse_datetime(date_string: str | None) -> datetime | None:
...@@ -138,8 +138,8 @@ def get_values( ...@@ -138,8 +138,8 @@ def get_values(
def update_links( def update_links(
instance: Union["Host", "Note", "Show"], links: list[Link] instance: Union["Profile", "Note", "Show"], links: list[Link]
) -> Union["Host", "Note", "Show"]: ) -> Union["Profile", "Note", "Show"]:
"""Update the links associated with the instance""" """Update the links associated with the instance"""
# delete the links associated with the instance # delete the links associated with the instance
...@@ -147,9 +147,9 @@ def update_links( ...@@ -147,9 +147,9 @@ def update_links(
for link in instance.links.all(): for link in instance.links.all():
link.delete(keep_parents=True) link.delete(keep_parents=True)
if isinstance(instance, Host): if isinstance(instance, Profile):
for link_data in links: for link_data in links:
HostLink.objects.create(host=instance, **link_data) ProfileLink.objects.create(profile=instance, **link_data)
if isinstance(instance, Note): if isinstance(instance, Note):
for link_data in links: for link_data in links:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment