
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _


def validate_part_name(value):
    # Prevent some illegal characters in part names
    for c in ['/', '\\', '|', '#', '$']:
        if c in str(value):
            raise ValidationError(
                _('Invalid character in part name')
            )


from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _


def validate_part_name(value):
    # Prevent some illegal characters in part names
    for c in ['|', '#', '$']:
        if c in str(value):
            raise ValidationError(
                _('Invalid character in part name')
            )

Allow some more chars in part names
Allow some more chars in part names

  
  from django.core.exceptions import ValidationError
  from django.utils.translation import gettext_lazy as _
  
  
  def validate_part_name(value):
      # Prevent some illegal characters in part names
-     for c in ['/', '\\', '|', '#', '$']:
+     for c in ['|', '#', '$']:
          if c in str(value):
              raise ValidationError(
                  _('Invalid character in part name')
              )
  
Allow some more chars in part names
## Code Before:

from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _


def validate_part_name(value):
    # Prevent some illegal characters in part names
    for c in ['/', '\\', '|', '#', '$']:
        if c in str(value):
            raise ValidationError(
                _('Invalid character in part name')
            )

## Instruction:
Allow some more chars in part names
## Code After:

from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _


def validate_part_name(value):
    # Prevent some illegal characters in part names
    for c in ['|', '#', '$']:
        if c in str(value):
            raise ValidationError(
                _('Invalid character in part name')
            )
