def get_url(self, obj):
     uri = reverse("api_v1_1:acl-role-detail", args=(obj.pk, ))
     if hasattr(self, '_context'):
         if 'request' in self._context:
             request = self._context['request']
             return request.build_absolute_uri(uri)
     return build_absolute_uri(uri)  # skip-test-coverage
 def get_url(self, obj):
     uri = reverse(
         "{}:{}-detail".format(api_namespace,
                               meta_model.get_dashed_case_class_name()),
         args=(obj.pk, ),
     )
     if hasattr(self, '_context'):
         if 'request' in self._context:
             request = self._context['request']
             return request.build_absolute_uri(uri)
     return build_absolute_uri(uri)  # skip-test-coverage
 def get_url(self, obj):
     uri = reverse("{}:account-me".format(self.api_namespace))
     return build_absolute_uri(uri)
Exemple #4
0
 def test_build_absolute_uri(self):
     self.assertEqual(build_absolute_uri(uri='/uri'),
                      'http://testserver:80/uri')