Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
steering
Commits
d5bb93a0
Verified
Commit
d5bb93a0
authored
8 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
feat: update utils Host -> Profile
parent
9f310592
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/utils.py
+6
-6
6 additions, 6 deletions
program/utils.py
with
6 additions
and
6 deletions
program/utils.py
+
6
−
6
View file @
d5bb93a0
...
@@ -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
,
Not
eLink
,
Show
,
ShowLink
from
program.models
import
Note
,
NoteLink
,
Profile
,
Profil
eLink
,
Show
,
ShowLink
else
:
else
:
from
program.models
import
Host
,
HostLink
,
Note
,
Not
eLink
,
Show
,
ShowLink
from
program.models
import
Note
,
NoteLink
,
Profile
,
Profil
eLink
,
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
:
Host
Link
.
objects
.
create
(
host
=
instance
,
**
link_data
)
Profile
Link
.
objects
.
create
(
profile
=
instance
,
**
link_data
)
if
isinstance
(
instance
,
Note
):
if
isinstance
(
instance
,
Note
):
for
link_data
in
links
:
for
link_data
in
links
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment