معرفی شرکت ها


drf-crud-proxy-0.4.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Separate serializers for parsing requests and returning responses in DRF
ویژگی مقدار
سیستم عامل -
نام فایل drf-crud-proxy-0.4.0
نام drf-crud-proxy
نسخه کتابخانه 0.4.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده attevaltojarvi
ایمیل نویسنده atte.valtojarvi@gmail.com
آدرس صفحه اصلی https://github.com/attevaltojarvi/drf-crud-proxy
آدرس اینترنتی https://pypi.org/project/drf-crud-proxy/
مجوز MIT
DRF CRUD Proxy ============== This package provides extended Django REST Framework generic views and viewsets that provide the possibility to specify different serializers for reading the incoming request and presenting the response. This is super handy in situations where you want to, for example, let the user send a ForeignKey attribute, but present the related object alongside the response instead of only the database ID. Requirements ------------ - Python 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11 - Django 3.2, 4.0, 4.1 and 4.2 (basically works with older versions as well, but they're EOL) - Django REST Framework 3.8 or newer (probably works on any 3.x version) Installation ------------ .. code:: pip install drf-crud-proxy Usage ----- Import the generic views and subclass your own views from them. Specify ``request_serializer_class`` and/or ``response_serializer_class`` to the view (both default to DRF's own ``serializer_class`` attribute). .. code:: python # api/views.py from drf_crud_proxy import generics from app.models import MyModel from api.serializers import MyModelCreateSerializer, MyModelSerializer class MyModelListCreateView(generics.ProxiedListCreateAPIView): queryset = MyModel.objects.all() request_serializer_class = MyModelCreateSerializer response_serializer_class = MyModelSerializer The incoming request is handled with ``MyModelCreateSerializer`` and the response with ``MyModelSerializer``. If you want to customize the data on either situation, override ``get_request_data`` and/or ``get_response_data`` methods in the view. The package also supports the so-called ``PUT-as-create`` behavior that was removed from DRF in its 3.0 release. Note that the user has to have model permissions for the corresponding create behavior (``POST`` request). **NOTE**: The ``PUT-as-create`` functionality doesn't have tests (yet). License ------- MIT Inspiration ----------- This functionality in DRF is something I've needed in numerous Django projects, so hopefully this will help someone else too :) This package has been built on top of the ideas presented by the great vintasoftware's ``drf-rw-serializers`` (https://github.com/vintasoftware/drf-rw-serializers) package. Thanks!


نیازمندی

مقدار نام
<5.0,>=3.2 Django
>=3.8 djangorestframework


نحوه نصب


نصب پکیج whl drf-crud-proxy-0.4.0:

    pip install drf-crud-proxy-0.4.0.whl


نصب پکیج tar.gz drf-crud-proxy-0.4.0:

    pip install drf-crud-proxy-0.4.0.tar.gz