Giter Site home page Giter Site logo

restframework-definable-serializer's Introduction

CircleCI RTD

restframework-definable-serializer

restframework-definable-serializer is definable serializer by JSON or YAML format.

Feature

  • It can define restframework serializer by JSON or YAML
  • It can write and modify serializer by django admin pages.

Dependencies

  • python 3
  • django>=1.11 or django>=2.2.7
  • djangorestframework>=3.7.0
  • django-codemirror2>=0.2
  • django-jsonfield>=1.0.1
  • django-yamlfield>=1.0.3
  • PyYAML>=5.2
  • ruamel.yaml>=0.13.5
  • simplejson>=3.11.1
  • six>=1.13.0

Quick start

  1. Install restframework-definable-serializer
pip install restframework-definable-serializer
  1. Add "definable_serializer" and "codemirror2" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
    ...
    'definable_serializer',
    'codemirror2',
]

Documentation

For extensive Japanese documentation see the docs read it on Readthedocs

Translation

Transifex(https://www.transifex.com/restframework-definable-serializer/restframework-definable-serializer-documentation/dashboard/) is used to manage translations.

Feel free to improve translations.

Currently supported languages are:

  • Japanese

You can request to add your own language directly on Transifex.

Sample code

You can try restframework-definable-serializer. See example_project

restframework-definable-serializer's People

Contributors

salexkidd avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

restframework-definable-serializer's Issues

Handle serializer validators

I want to use Serializer validator classes.
Because, validate_methods are dangerous when general user used.

Validator class is safe because it only specifies.

I'll show example yml definition and serializer_class
eg:

main:
  name: UsingValidator
  fields:
    - name: using_validator_field
      field: CharField
      validators:
        - validator: definable_serializer.tests.test_serializers.CorrectDataValidator
          args:
            - correct_data

        - validator: definable_serializer.tests.test_serializers.CorrectDataValidator
          args:
            - corr ect_data
UsingValidator():
    using_validator_field = CharField(
        validators[
            <definable_serializer.tests.test_serializers.CorrectDataValidator object>,
            <definable_serializer.tests.test_serializers.CorrectDataValidator object>
        ]
    )
  • writing code
  • writing testcode
  • documenting
  • upload to pypi

label & help_text translation

Need label & help_text translation.

eg:

main:
  name: NeedTranslationHelpAndLabel
  fields:
    - name: test_field
      field: CharField
      field_kwargs:
        label: "これは日本語です"
        label_ja: "これは日本語です"
        label_en: "It's English"
        label_fr: "Ç'est  Français"
        label_klingon: "tlhIngan mu'mey ghotvam'e'."

allow_validate_method option to DefinableSerializer fields

someone need allow_validate_method by Security reason.
because, validate_method is dangerous for general users to define.

main:
  name: TestSerializer
  fields:
    - name: test_field
      field: CharField
      field_validate_method: |
        def validate_method(self, value):
            from django.contrib.auth import get_user_model
            get_user_model().objects.all().delete()
            return "YEAH!!!!!!"
  • add allow_validate_method option
  • add test code
  • documenting

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.