Skip to content
Snippets Groups Projects

Resolve "DjangoLDP resolve_id error on container path"

Merged Calum Mackervoy requested to merge 245-resolve-id-fixes into master
1 unresolved thread

Closes #245 (closed)

Also related to #244 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
116 116
117 117 @classonlymethod
118 118 def resolve_id(cls, id):
119 '''
120 Resolves the id of a given path (e.g. /container/1/)
121 Raises Resolver404 if the path cannot be found, ValidationError if the path is for a model base
122 and an ObjectDoesNotExist exception if the resource does not exist
123 '''
119 124 id = cls.__clean_path(id)
120 view, args, kwargs = get_resolver().resolve(id)
125 match = get_resolver().resolve(id)
126 kwargs = match.kwargs
127 view = match.func
128
129 if match.url_name.endswith('-list') or len(match.kwargs.keys()) == 0:
  • I realise this is hacky, but I couldn't find another solution using the data we can resolve with the url

    from the shell

    get_resolver().resolve('/circles/1/members/')
    ResolverMatch(func=djangoldp.views.LDPNestedViewSet, args=(), kwargs={'pk': '1'}, url_name=circle-circlemember-list, app_names=[], namespaces=[])
    
    get_resolver().resolve('/circles/1/members/2/')
    ResolverMatch(func=djangoldp.views.LDPNestedViewSet, args=(), kwargs={'pk': '2'}, url_name=circle-circlemember-detail, app_names=[], namespaces=[])
  • Please register or sign in to reply
  • mentioned in issue #244 (closed)

  • mentioned in merge request djangoldp-circle!22 (merged)

  • mentioned in commit e6316086

  • Please register or sign in to reply
    Loading