Answers for "django comma separated field mysql"

SQL
0

django comma separated field mysql

from django.db import models

class CommaSepField(models.Field):
    "Implements comma-separated storage of lists"

    def __init__(self, separator=",", *args, **kwargs):
        self.separator = separator
        super().__init__(*args, **kwargs)

    def deconstruct(self):
        name, path, args, kwargs = super().deconstruct()
        # Only include kwarg if it's not the default
        if self.separator != ",":
            kwargs['separator'] = self.separator
        return name, path, args, kwargs
Posted by: Guest on May-10-2021

Code answers related to "django comma separated field mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language