mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #6223 from ryanpetrello/new_credential_model
add a view for `/api/v2/credential_types/N/activity_stream/`
This commit is contained in:
commit
6e0f580e15
@ -1869,10 +1869,13 @@ class CredentialTypeSerializer(BaseSerializer):
|
||||
|
||||
def get_related(self, obj):
|
||||
res = super(CredentialTypeSerializer, self).get_related(obj)
|
||||
res['credentials'] = reverse(
|
||||
res['credentials'] = self.reverse(
|
||||
'api:credential_type_credential_list',
|
||||
kwargs={'pk': obj.pk},
|
||||
request=self.context.get('request')
|
||||
kwargs={'pk': obj.pk}
|
||||
)
|
||||
res['activity_stream'] = self.reverse(
|
||||
'api:credential_type_activity_stream_list',
|
||||
kwargs={'pk': obj.pk}
|
||||
)
|
||||
return res
|
||||
|
||||
|
@ -167,6 +167,7 @@ credential_type_urls = patterns('awx.api.views',
|
||||
url(r'^$', 'credential_type_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/$', 'credential_type_detail'),
|
||||
url(r'^(?P<pk>[0-9]+)/credentials/$', 'credential_type_credential_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/activity_stream/$', 'credential_type_activity_stream_list'),
|
||||
)
|
||||
|
||||
credential_urls = patterns('awx.api.views',
|
||||
|
@ -1521,6 +1521,16 @@ class CredentialTypeCredentialList(SubListAPIView):
|
||||
new_in_api_v2 = True
|
||||
|
||||
|
||||
class CredentialTypeActivityStreamList(ActivityStreamEnforcementMixin, SubListAPIView):
|
||||
|
||||
model = ActivityStream
|
||||
serializer_class = ActivityStreamSerializer
|
||||
parent_model = CredentialType
|
||||
relationship = 'activitystream_set'
|
||||
new_in_320 = True
|
||||
new_in_api_v2 = True
|
||||
|
||||
|
||||
class CredentialList(ListCreateAPIView):
|
||||
|
||||
model = Credential
|
||||
|
Loading…
Reference in New Issue
Block a user