Skip to content

Instantly share code, notes, and snippets.

View kelechi2020's full-sized avatar

Egbosi Kelechi kelechi2020

View GitHub Profile
@eerien
eerien / forms.py
Last active January 9, 2025 10:16
Comma Separated Values Form Field for Django. There are CommaSeparatedCharField, CommaSeparatedIntegerField.
from django import forms
from django.core import validators
from django.core.exceptions import ValidationError
class MinLengthValidator(validators.MinLengthValidator):
message = 'Ensure this value has at least %(limit_value)d elements (it has %(show_value)d).'
class MaxLengthValidator(validators.MaxLengthValidator):
message = 'Ensure this value has at most %(limit_value)d elements (it has %(show_value)d).'