-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Allow shared subnets to have non shared child subnets #90 #92
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rebase on the current master and see my comment below?
openwisp_ipam/base/models.py
Outdated
organization_query = Q(organization_id=self.organization_id) | ||
error_message = _('Subnet overlaps with {0}.') | ||
if self.master_subnet: | ||
if self.master_subnet.organization_id is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works if there's only 1 level, but may not work if the master subnet does have an org set but has itself a relation to another master subnet which is shared, that's why in one of the validation checks below we iterate over all the master subnets
c05582f
to
1f94d97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works. I am not sure it will work with nested master subnets, if you can check it would be great, if it doesn't work we can create an issue to deal with that later on.
Please fix the conflict and solve the issue highlighted in the comment below.
openwisp_ipam/admin.py
Outdated
'will be automatically suggested in the ip address field' | ||
) | ||
except KeyError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is causing the coverage to go down.
There should be a simpler way to redefine help_text
of specific fields, please see: https://docs.djangoproject.com/en/3.1/topics/forms/modelforms/#overriding-the-default-fields
I hope you can use that method instead of this.
1f94d97
to
9b1b18d
Compare
Yes, does it work?
Ok, let's ignore it now, I created an issue for this: #96 |
9b1b18d
to
1e0ddf4
Compare
I have added a test for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Closes #90