-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added option to define step values for grid labeling #115
Added option to define step values for grid labeling #115
Conversation
…an Grids. Updated documentation and tests.
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.
Please see comments on implementing Custom Validator instead of having it in the save method.
@smk4664 are we good to merge this one yet? |
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 for the changes! I offered a suggestion on how to implement the validator as a class, but this is optional.
@@ -20,3 +23,13 @@ def grid_letter_to_number(letter): | |||
if letter[:-1]: | |||
return 26 * (grid_letter_to_number(letter[:-1])) + number | |||
return number | |||
|
|||
|
|||
def validate_not_zero(value): |
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.
Not blocking, but to get around the validate_not_zero.message and follow established Django Pattern, you can change this to a class. In case you need this in the future.
def validate_not_zero(value): | |
from django.core.validators import BaseValidator | |
class NonZeroValidator(BaseValidator): | |
""" | |
Ensure that the field's value is not zero. | |
""" | |
message = "Must be a positive or negative Integer not equal to zero." | |
code = "zero_not_allowed" | |
def __call__(self, value): | |
if value == 0: | |
raise ValidationError( | |
self.message, | |
code=self.code, | |
) |
Added option to define step values for use in the labeling of FloorPlan Grids. Updated documentation and tests.