We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have made the regex field available in the Django admin panel, but every time I save it, it wraps the field in re.compile('...').
re.compile('...')
path = RegexField(max_length=128, blank=False, null=False)
I end up with something like:
re.compile('re.compile("re.compile(\'/post/\\\\\\\\d/\')")')
It could be that I'm using this incorrectly somehow, but I'm not sure what's wrong.
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
Work-around:
from django.forms.fields import CharField from regex_field.fields import RegexField as BrokenRegexField class FixedRegexField(CharField): def prepare_value(self, value): try: return value.pattern except AttributeError: return value class RegexField(BrokenRegexField): def formfield(self, **kwargs): defaults = {'form_class': FixedRegexField} defaults.update(kwargs) return super().formfield(**defaults)
No branches or pull requests
I have made the regex field available in the Django admin panel, but every time I save it, it wraps the field in
re.compile('...')
.I end up with something like:
It could be that I'm using this incorrectly somehow, but I'm not sure what's wrong.
The text was updated successfully, but these errors were encountered: