Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
99
Issue boards
Milestones
Wiki
Code
Merge requests
5
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
djangoldp-packages
djangoldp
Commits
e474c966
Verified
Commit
e474c966
authored
5 years ago
by
Jean-Baptiste Pasquier
Browse files
Options
Downloads
Patches
Plain Diff
fix: missing webid without djangoldp_account
parent
8106cfb6
No related branches found
Branches containing commit
Tags
v0.6.19
Tags containing commit
No related merge requests found
Pipeline
#1139
passed with stage
in 1 minute and 23 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
djangoldp/models.py
+16
-1
16 additions, 1 deletion
djangoldp/models.py
djangoldp/tests/djangoldp_urls.py
+0
-1
0 additions, 1 deletion
djangoldp/tests/djangoldp_urls.py
djangoldp/tests/models.py
+0
-13
0 additions, 13 deletions
djangoldp/tests/models.py
djangoldp/urls.py
+4
-0
4 additions, 0 deletions
djangoldp/urls.py
with
20 additions
and
15 deletions
djangoldp/models.py
+
16
−
1
View file @
e474c966
import
validators
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
from
django.db
import
models
from
django.db.models.base
import
ModelBase
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django.urls
import
get_resolver
from
django.urls
import
reverse_lazy
,
get_resolver
from
django.utils.datastructures
import
MultiValueDictKeyError
from
django.utils.decorators
import
classonlymethod
...
...
@@ -180,3 +182,16 @@ def auto_urlid(sender, instance, **kwargs):
if
(
instance
.
urlid
is
None
or
instance
.
urlid
==
''
or
'
None
'
in
instance
.
urlid
):
instance
.
urlid
=
instance
.
get_absolute_url
()
instance
.
save
()
if
'
djangoldp_account
'
not
in
settings
.
DJANGOLDP_PACKAGES
:
def
webid
(
self
):
# hack : We user webid as username for external user (since it's an uniq identifier too)
if
validators
.
url
(
self
.
username
):
webid
=
self
.
username
else
:
webid
=
'
{0}{1}
'
.
format
(
settings
.
BASE_URL
,
reverse_lazy
(
'
user-detail
'
,
kwargs
=
{
'
pk
'
:
self
.
pk
}))
return
webid
get_user_model
().
_meta
.
serializer_fields
=
[
'
@id
'
]
get_user_model
().
webid
=
webid
This diff is collapsed.
Click to expand it.
djangoldp/tests/djangoldp_urls.py
+
0
−
1
View file @
e474c966
...
...
@@ -8,7 +8,6 @@ urlpatterns = [
url
(
r
'
^messages/
'
,
LDPViewSet
.
urls
(
model
=
Message
,
permission_classes
=
[],
fields
=
[
"
@id
"
,
"
text
"
,
"
conversation
"
],
nested_fields
=
[
'
conversation
'
])),
url
(
r
'
^conversations/
'
,
LDPViewSet
.
urls
(
model
=
Conversation
,
nested_fields
=
[
"
message_set
"
],
permission_classes
=
())),
url
(
r
'
^tasks/
'
,
LDPViewSet
.
urls
(
model
=
Task
,
permission_classes
=
())),
url
(
r
'
^users/
'
,
LDPViewSet
.
urls
(
model
=
settings
.
AUTH_USER_MODEL
,
permission_classes
=
[])),
url
(
r
'
^dummys/
'
,
LDPViewSet
.
urls
(
model
=
Dummy
,
permission_classes
=
[],
lookup_field
=
'
slug
'
,)),
]
This diff is collapsed.
Click to expand it.
djangoldp/tests/models.py
+
0
−
13
View file @
e474c966
import
validators
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
from
django.db
import
models
from
django.urls
import
reverse_lazy
from
django.utils.datetime_safe
import
date
from
djangoldp.models
import
Model
...
...
@@ -171,17 +169,6 @@ class Circle(Model):
rdf_type
=
'
hd:circle
'
depth
=
1
def
webid
(
self
):
# hack : We user webid as username for external user (since it's an uniq identifier too)
if
validators
.
url
(
self
.
username
):
webid
=
self
.
username
else
:
webid
=
'
{0}{1}
'
.
format
(
settings
.
BASE_URL
,
reverse_lazy
(
'
user-detail
'
,
kwargs
=
{
'
pk
'
:
self
.
pk
}))
return
webid
get_user_model
().
_meta
.
serializer_fields
=
[
'
@id
'
,
'
username
'
,
'
first_name
'
,
'
last_name
'
,
'
email
'
,
'
userprofile
'
,
'
conversation_set
'
,
'
circle_set
'
]
get_user_model
().
webid
=
webid
get_user_model
().
_meta
.
anonymous_perms
=
[
'
view
'
,
'
add
'
]
This diff is collapsed.
Click to expand it.
djangoldp/urls.py
+
4
−
0
View file @
e474c966
...
...
@@ -6,6 +6,7 @@ from django.conf.urls import url, include
from
djangoldp.models
import
LDPSource
,
Model
from
djangoldp.permissions
import
LDPPermissions
from
djangoldp.views
import
LDPSourceViewSet
,
WebFingerView
from
djangoldp.views
import
LDPViewSet
def
__clean_path
(
path
):
...
...
@@ -46,3 +47,6 @@ for package in settings.DJANGOLDP_PACKAGES:
urlpatterns
.
append
(
url
(
r
'
^
'
,
include
(
'
{}.djangoldp_urls
'
.
format
(
package
))))
except
ModuleNotFoundError
:
pass
if
'
djangoldp_account
'
not
in
settings
.
DJANGOLDP_PACKAGES
:
urlpatterns
.
append
(
url
(
r
'
^users/
'
,
LDPViewSet
.
urls
(
model
=
settings
.
AUTH_USER_MODEL
,
permission_classes
=
[])))
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