semvec/pypi-packages huggingface dataset:
django-rest-enumfield 0.2.0
EnumField for Django REST Framework
License: MIT
Keywords: enum django rest framework drf rest_framework

Django REST EnumField
=====================

|Build Status| |PyPI version| |Coveralls Status| |Black|

**EnumField that uses python enums for Django REST Framework**

Installation
============

::

   pip install django-rest-enumfield


Usage
=====

Use it as if its a ``ChoiceField``:

.. code:: python

   import enum
   from rest_enumfield import EnumField

   class Color(enum.Enum):
      RED = "red"
      GREEN = "green"
      BLUE = "blue"

   class SomeSerializer(Serializer):

      color = EnumField(choices=Color)


Additionally you can override choice name and value generation by providing ``to_choice`` or ``to_repr`` arguments:

.. code:: python

   class SomeSerializer(Serializer):

      color = EnumField(choices=Color, to_choice=lambda x: (x.value, x.name), to_repr=lambda x: x.value)

This will cause the enum's value instead of the name to be represented.

Thats it.

.. |Build Status| image:: https://travis-ci.com/shosca/django-rest-enumfield.svg?branch=master
   :target: https://travis-ci.com/shosca/django-rest-enumfield
.. |PyPI version| image:: https://badge.fury.io/py/django-rest-enumfield.svg
   :target: https://badge.fury.io/py/django-rest-enumfield
.. |Coveralls Status| image:: https://coveralls.io/repos/github/shosca/django-rest-enumfield/badge.svg?branch=master
   :target: https://coveralls.io/github/shosca/django-rest-enumfield?branch=master
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/ambv/black
galileo-socketio 4.0.1.1
Socket.IO server
License: MIT

python-socketio
===============

.. image:: https://travis-ci.org/miguelgrinberg/python-socketio.svg?branch=master
    :target: https://travis-ci.org/miguelgrinberg/python-socketio

Python implementation of the `Socket.IO`_ realtime client and server.

Resources
---------

-  `Documentation`_
-  `PyPI`_
-  Questions? See the `questions`_ others have asked on Stack Overflow, or `ask`_ your own question.

.. _Socket.IO: https://github.com/socketio/socket.io
.. _Documentation: http://python-socketio.readthedocs.io/en/latest/
.. _PyPI: https://pypi.python.org/pypi/python-socketio
.. _questions: https://stackoverflow.com/questions/tagged/python-socketio
.. _ask: https://stackoverflow.com/questions/ask?tags=python+python-socketio
galileo-engineio 3.5.1
Engine.IO server
License: MIT

python-engineio
===============

.. image:: https://travis-ci.org/miguelgrinberg/python-engineio.svg?branch=master
    :target: https://travis-ci.org/miguelgrinberg/python-engineio

Python implementation of the `Engine.IO`_ realtime client and server.

Resources
---------

-  `Documentation`_
-  `PyPI`_
-  Questions? See the `questions`_ others have asked on Stack Overflow, or `ask`_ your own question.

.. _Engine.IO: https://github.com/socketio/engine.io
.. _Documentation: https://python-engineio.readthedocs.io/en/latest/
.. _PyPI: https://pypi.python.org/pypi/python-engineio
.. _questions: https://stackoverflow.com/questions/tagged/python-socketio
.. _ask: https://stackoverflow.com/questions/ask?tags=python+python-socketio