mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Added field deconstruct method so ImplicitRoleField works in migrations
Apparently we need this, who'da known. https://docs.djangoproject.com/en/1.9/howto/custom-model-fields/
This commit is contained in:
@@ -97,6 +97,14 @@ class ImplicitRoleField(models.ForeignKey):
|
|||||||
kwargs.setdefault('null', 'True')
|
kwargs.setdefault('null', 'True')
|
||||||
super(ImplicitRoleField, self).__init__(*args, **kwargs)
|
super(ImplicitRoleField, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def deconstruct(self):
|
||||||
|
name, path, args, kwargs = super(ImplicitRoleField, self).deconstruct()
|
||||||
|
kwargs['role_name'] = self.role_name
|
||||||
|
kwargs['role_description'] = self.role_description
|
||||||
|
kwargs['permissions'] = self.permissions
|
||||||
|
kwargs['parent_role'] = self.parent_role
|
||||||
|
return name, path, args, kwargs
|
||||||
|
|
||||||
def contribute_to_class(self, cls, name):
|
def contribute_to_class(self, cls, name):
|
||||||
super(ImplicitRoleField, self).contribute_to_class(cls, name)
|
super(ImplicitRoleField, self).contribute_to_class(cls, name)
|
||||||
setattr(cls, self.name, ImplicitRoleDescriptor(self))
|
setattr(cls, self.name, ImplicitRoleDescriptor(self))
|
||||||
|
|||||||
Reference in New Issue
Block a user