Skip to content

Instantly share code, notes, and snippets.

View imomaliev's full-sized avatar
🐼

Sardorbek Imomaliev imomaliev

🐼
View GitHub Profile
@imomaliev
imomaliev / fields.py
Last active January 12, 2024 14:13 — forked from jpadilla/fields.py
CharacterSeparatedManyField - A Django REST framework field that separates a string with a given separator into a native list and reverts a list into a string separated with a given separator.
from rest_framework import serializers
from rest_framework.fields import empty
from rest_framework.utils import html
class CharacterSeparatedField(serializers.ListField):
"""
Character separated ListField.
Based on https://gist.github.com/jpadilla/8792723.