1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Fixing up settings reset issue

This is done by not assigning the ActivityStream foreign key.  Which is
almost superflous at this point
This commit is contained in:
Matthew Jones 2016-01-05 14:34:40 -05:00
parent d2f99ad549
commit ae12be9afa
3 changed files with 10 additions and 4 deletions

View File

@ -161,7 +161,7 @@ class APIView(views.APIView):
''' '''
ret = super(APIView, self).metadata(request) ret = super(APIView, self).metadata(request)
added_in_version = '1.2' added_in_version = '1.2'
for version in ('2.4.0', '2.3.0', '2.2.0', '2.1.0', '2.0.0', '1.4.8', '1.4.5', '1.4', '1.3'): for version in ('3.0.0', '2.4.0', '2.3.0', '2.2.0', '2.1.0', '2.0.0', '1.4.8', '1.4.5', '1.4', '1.3'):
if getattr(self, 'new_in_%s' % version.replace('.', ''), False): if getattr(self, 'new_in_%s' % version.replace('.', ''), False):
added_in_version = version added_in_version = version
break break

View File

@ -554,4 +554,4 @@ class Migration(SchemaMigration):
} }
} }
complete_apps = ['main'] complete_apps = ['main']

View File

@ -321,7 +321,12 @@ def activity_stream_create(sender, instance, created, **kwargs):
object1=object1, object1=object1,
changes=json.dumps(model_to_dict(instance, model_serializer_mapping))) changes=json.dumps(model_to_dict(instance, model_serializer_mapping)))
activity_entry.save() activity_entry.save()
getattr(activity_entry, object1).add(instance) print("Instance: {}".format(instance))
#TODO: Weird situation where cascade SETNULL doesn't work
# it might actually be a good idea to remove all of these FK references since
# we don't really use them anyway.
if type(instance) is not TowerSettings:
getattr(activity_entry, object1).add(instance)
def activity_stream_update(sender, instance, **kwargs): def activity_stream_update(sender, instance, **kwargs):
if instance.id is None: if instance.id is None:
@ -348,7 +353,8 @@ def activity_stream_update(sender, instance, **kwargs):
object1=object1, object1=object1,
changes=json.dumps(changes)) changes=json.dumps(changes))
activity_entry.save() activity_entry.save()
getattr(activity_entry, object1).add(instance) if type(instance) is not TowerSettings:
getattr(activity_entry, object1).add(instance)
def activity_stream_delete(sender, instance, **kwargs): def activity_stream_delete(sender, instance, **kwargs):
if not activity_stream_enabled: if not activity_stream_enabled: