mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Add object_association for m2m relationships
Now when displaying a m2m relationship change we'll show the related field mapping that changed.
This commit is contained in:
parent
dd5a7bbd62
commit
99f048dfe5
@ -2004,11 +2004,12 @@ class ScheduleSerializer(BaseSerializer):
|
||||
class ActivityStreamSerializer(BaseSerializer):
|
||||
|
||||
changes = serializers.SerializerMethodField('get_changes')
|
||||
object_association = serializers.SerializerMethodField('get_object_association')
|
||||
|
||||
class Meta:
|
||||
model = ActivityStream
|
||||
fields = ('*', '-name', '-description', '-created', '-modified',
|
||||
'timestamp', 'operation', 'changes', 'object1', 'object2')
|
||||
'timestamp', 'operation', 'changes', 'object1', 'object2', 'object_association')
|
||||
|
||||
def get_fields(self):
|
||||
ret = super(ActivityStreamSerializer, self).get_fields()
|
||||
@ -2033,6 +2034,13 @@ class ActivityStreamSerializer(BaseSerializer):
|
||||
logger.warn("Error deserializing activity stream json changes")
|
||||
return {}
|
||||
|
||||
def get_object_association(self, obj):
|
||||
try:
|
||||
return obj.object_relationship_type.split(".")[-1].split("_")[1]
|
||||
except:
|
||||
pass
|
||||
return ""
|
||||
|
||||
def get_related(self, obj):
|
||||
rel = {}
|
||||
if obj.actor is not None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user