Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Fay Arnold
djangoldp
Commits
125373c8
Commit
125373c8
authored
4 years ago
by
Calum Mackervoy
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: removed get_or_create part
parent
db607700
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
djangoldp/models.py
+2
-4
2 additions, 4 deletions
djangoldp/models.py
with
2 additions
and
4 deletions
djangoldp/models.py
+
2
−
4
View file @
125373c8
...
...
@@ -180,9 +180,7 @@ class Model(models.Model):
'''
try
:
logger
.
debug
(
'
[get_or_create]
'
+
str
(
model
)
+
'
backlink
'
+
str
(
urlid
))
url
=
urlparse
(
urlid
)
url
=
url
.
netloc
+
url
.
path
+
url
.
fragment
rval
=
model
.
objects
.
get
(
urlid__contains
=
url
)
rval
=
model
.
objects
.
get
(
urlid
=
urlid
)
if
update
:
for
field
in
field_tuples
.
keys
():
setattr
(
rval
,
field
,
field_tuples
[
field
])
...
...
@@ -239,7 +237,7 @@ class Model(models.Model):
'''
returns True if the urlid of the value passed is from an external source
'''
try
:
url
=
urlparse
(
value
.
urlid
)
return
value
.
urlid
is
not
None
and
not
url
.
netloc
=
=
urlparse
(
settings
.
SITE_URL
).
netloc
return
value
.
urlid
is
not
None
and
not
url
.
netloc
!
=
urlparse
(
settings
.
SITE_URL
).
netloc
except
:
return
False
...
...
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