mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
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:
parent
274744b4c1
commit
682552d9b0
@ -97,6 +97,14 @@ class ImplicitRoleField(models.ForeignKey):
|
||||
kwargs.setdefault('null', 'True')
|
||||
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):
|
||||
super(ImplicitRoleField, self).contribute_to_class(cls, name)
|
||||
setattr(cls, self.name, ImplicitRoleDescriptor(self))
|
||||
|
Loading…
Reference in New Issue
Block a user