Saravanan666/pypi-org huggingface dataset:
Package: drf-form-bootstrap-4
This package is no longer distributed on PyPI.You can now review and download packages at our own Python registry-https://balto.baltorepo.com/open-source/python/packages/drf-form-bootstrap-4/drf-form-bootstrap-4Bootstrap 4 templates forDjango REST Frameworkrender_formtag.RequirementsTested with Django 2.2, DRF 3.9, Python 3.6 & 3.5. Almost certainly works in earlier versions.InstallationFrom PyPI:pip install drf-form-bootstrap-4Adddrfformbootstrap4to yourINSTALLED_APPSsetting.INSTALLED_APPS = (
    ...
    'drfformbootstrap4',
)UsageLike the template packs in Django REST Framework, this supports three layouts:Vertical<form method="POST" novalidate>
  {% csrf_token %}
  {% render_form serializer template_pack='drfformbootstrap4/vertical' %}
  <div class="row">
    <div class="col text-right">
      <input class="btn btn-primary" type="submit" value="Submit">
    </div>
  </div>
</form>Horizontal<form method="POST" novalidate>
  {% csrf_token %}
  {% render_form serializer template_pack='drfformbootstrap4/horizontal' %}
  <div class="row">
    <div class="col text-right">
      <input class="btn btn-primary" type="submit" value="Submit">
    </div>
  </div>
</form>InlineNote thatinlineis less well-tested than the others, and at the moment the error states don't  render properly. If this is a problem for you,add a comment to this issue.<form method="POST" novalidate class="form-inline">
  {% csrf_token %}
  {% render_form serializer template_pack='drfformbootstrap4/inline' %}
  <div class="row">
    <div class="col text-right">
      <input class="btn btn-primary" type="submit" value="Submit">
    </div>
  </div>
</form>Additional OptionsUse thestylefield on your serializer to change the appearance of a field.To display a field as text instead of as a field:style={'class': 'form-control-plaintext'}For inline checkboxes and radio buttons:style={'inline': True}Prepend/append text for inputs:style={
    'prepend': 'text to prepend',
    'append': 'text to append',
}DevelopmentPretty standard: fork this repo, make changes, make a GitHub pull request.There are demo pages showing a variety of form fields and layouts. To use it, first install its dependencies:pip install -r requirements.txtThen run the server:make runserverWhen using thisrunserver, you don't need to installdrfformbootstrap4into your virtualenv before seeing changes. However if you want to see your changes reflected in a different application using the same virtualenv, install it with:make installBuilds are here:https://travis-ci.org/mattfox/drf-form-bootstrap-4License© 2019 Matthew FoxMIT
Package: drf-friend
drf-friend is a collection of utilities and enhancements for Django Rest Framework (DRF), aiming to simplify and streamline the process of building RESTful APIs. It provides convenience functions, tools, and patterns to help developers write clean, efficient, and maintainable code when working with DRF.Features:

- Enhanced core components for common tasks in API development.
- Customized Django Rest Framework core classes for improved functionality.
- Utility functions and mixins to handle common API patterns.
- Simplifies pagination, routing, and data serialization tasks.Check the project repository for detailed documentation, examples, and updates:https://github.com/code4mk/drf-friendDoc:https://drf-friend.code4mk.orghiremostafa@gmail.com
Package: drf-generic-contact
DRF Generic ContactAn extension of thedjango-generic-contactthat provides a POST endpoint to create new instances for
theContactmodel via HTTP.Installationpipinstalldrf-generic-contactMake sure the main moduledjango-generic-contactis part of the INSTALLED_APPS.UsageAdd theContactViewSetto your project'surls.py, e.g.:from drf_generic_contact.rest.views import ContactViewSet

router = get_api_router()
router.register(r"contact", ContactViewSet)

urlpatterns = [
    ...
    path("", include(router.urls)),
]Seetests/testappfor exemplary usage.Unit TestsSee foldertests/. The provided tests cover these criteria:success:add new contact via HTTP POST requestfailure:HTTP GET request to read contact listHTTP GET request to read single contactHTTP PUT request to update contactHTTP PATCH request to update contactFollow below instructions to run the tests.
You may exchange the installed Django and DRF versions according to your requirements.
:warning: Depending on your local environment settings you might need to explicitly callpython3instead ofpython.# install dependenciespython-mpipinstall--upgradepip
pipinstall-rrequirements.txt# setup environmentpipinstall-e.# run testscdtests&&pythonmanage.pytestContributingContributions are welcomed! Read theContributing Guidefor more information.LicensingSeeLICENSEfor more information.
Package: drf-gitlab-webhook
drf-gitlab-webhookdrf-gitlab-webhook is a django app wich implements a webhook endpoint
for gitlab requests and send django signals for every hook event.Quick startAdd "drf_gitlab_webhook" to INSTALLED_APPS:INSTALLED_APPS = {
  ...
  'drf_gitlab_webhook'
}Include the drf_gitlab_webhook URLconf in urls.py:url(r'^webhook/', include('drf_gitlab_webhook.urls'))Then you have an endpoint calledwebhook/event/Dev notes:build package: python setup.py sdist
install: pip install --user drf-gitlab-webhook/dist/drf-gitlab-webhook-01.tar.gz
Package: drf-hcaptcha
Django REST hCAPTCHADjango REST hCAPTCHA v2 and v3 field serializerRequirementsPython: 3.7, 3.8, 3.9, 3.10, 3.11Django: 3.2, 4.0, 4.1, 4.2DRF: 3.11, 3.12, 3.13, 3.14InstallationInstall withpip install drf-hcaptchaAdd"drf_hcaptcha"to yourINSTALLED_APPSsettings.Set in settingsDRF_HCAPTCHA_SECRET_KEYINSTALLED_APPS=[...,"drf_hcaptcha",...,]...DRF_HCAPTCHA_SECRET_KEY="YOUR SECRET KEY"Usagefromrest_framework.serializersimportSerializerfromdrf_hcaptcha.fieldsimportHCaptchaV2FieldclassV2Serializer(Serializer):hcaptcha=HCaptchaV2Field()...SettingsDRF_HCAPTCHA_SECRET_KEY- set your hCAPTCHA secret key. Type: str.DRF_HCAPTCHA_DEFAULT_V3_SCORE- by default:0.5. Type: float.DRF_HCAPTCHA_ACTION_V3_SCORES- by default:{}. Type: dict. You can define specific score for each action e.g.{"login": 0.6, "feedback": 0.3}DRF_HCAPTCHA_DOMAIN- by default:api.hcaptcha.com. Type: str.DRF_HCAPTCHA_PROXY- by default:{}. Type: dict. e.g.{'http': 'http://127.0.0.1:8000', 'https': 'https://127.0.0.1:8000'}DRF_HCAPTCHA_VERIFY_REQUEST_TIMEOUT- by default:10. Type: int.Priority of secret_key valuesettingsDRF_HCAPTCHA_SECRET_KEYthe argumentsecret_keyof fieldrequest.context["hcaptcha_secret_key"]hCAPTCHA v3Validation is passed if the score value returned by Google is greater than or equal to required score.Required score value:0.0 - 1.0Priority of score valueIf not defined or zero in current item then value from next item.Value for action in settingsDRF_HCAPTCHA_ACTION_V3_SCORESValue in argumentrequired_scoreof fieldDefault value in settingsDRF_HCAPTCHA_DEFAULT_V3_SCOREDefault value0.5
Package: drf_health_check
drf_health_checkVarious health check extensions for the Django Rest FrameworkInstallationUsing pippip install drf_health_checkUsing pipenvpipenv install drf_health_checkQuick startIn your project’ssettings.pyaddHEALTH_CHECK_PROVIDERS.HEALTH_CHECK_PROVIDERS = {
    ...
    'drf_health_check.providers.DBHealthCheckProvider',
    ...
}Adddrf_health_checktoINSTALLED_APPSINSTALLED_APPS = [
    ...
    "drf_health_check",
]Add urls to you project for health-viewurlpatterns = [
    ...
    url("health/", include('django_health_check_view.urls')),
    ...
]
Package: drf-history
DRF-HISTORYdrf-history is a simple django rest framework app to track actions performed in a django app and to also gets the current request.
The actions being tracked arePOST,DELETE,PUTandPATCHData being captured isDataDescriptionuserThe current loggedin user making the requestrequest data(body)Data being sent (POST, PATCH and  PUT)response dataresponse data after the request is completetable_namename of the model the request is affectinginstance_idThe id of the created, updated or deleted model instancemethodThe request method i.e POST, DELETE, PUT or PATCHcreated_atDate time object for when the request is being carried outpathpath the request is coming fromQuick startAddtrack_actionsto your INSTALLED_APPS settingINSTALLED_APPS = [
     ...,
     'track_actions',
 ]Addtrack_actions.requestMiddleware.RequestMiddlewarein settings under middlewaresMIDDLEWARE = [
     ... ,
     'track_actions.requestMiddleware.RequestMiddleware',
 ]Runpython manage.py migrate track_actionsto create the History model.`python manage.py migrate track_actions`After this every POST, UPDATE and DELETE action will be recorded in your database under the history model.To prevent sensitive fields from being savedFor examplepasswords.You will have to create a yaml file calleddrf_history.yamlon the root of your django project.
In this file add the following.fields_to_exclude: ["password","another key here"]You can then add all sensitve fields in the list separated by commas. These fields will be removed from the saved request data. This will apply to all tables.This is only for data sent in the request.To get the current requestTo get the current request in progress anywhere in the application.Import the relevant class.from track_actions.requestMiddleware import RequestMiddleware2   Get the current request object.current_request = RequestMiddleware.get_request_data()[1]To access the get history endpointIn your project's url file`import track_actions`Register the url in the urlpattern`path('track_actions/', include('track_actions.urls'))`visit the url in the browser or on postman`http://127.0.0.1:8000/track_actions/history/`you should be able to see all the recorded history if you haveadminpriveleges and you are authenticated.AlternativelyYou can create your own endpoint to view all history from the History model by importing it in your views or serializers.`from track_actions.models import History`NOTEThis package will only work if you have a user in a request and a user model in your database.
Package: drf-htmx-renderer
DRF HTMX RendererDRF HTMX Rendereris a (renderer)[https://www.django-rest-framework.org/api-guide/renderers/] forDjango REST Framework.In the vain of the browsable API or the admin renderer shipped with DRF, it allows for browsing the API directly in your browser and making it fully human-friendly.To learn more about this project, you can watchthis talk- Slides availablehere.The aim of the project is to provide a customizable and extendable interface for data management that can be presented to the final user.InstallWith pippip install drf-htmx-rendererFrom githubgit clone git@github.com:nanuxbe/drf_htmx_renderer.git
cd drf_htmx_renderer
pip install -e .
pip install -r requirements-dev.txt

python manage.py runserverSettingsAdd these to Djangosettings.pyDRF_AUTO_METADATA_ADAPTER='htmx_renderer.adapters.HTMXEndpointAdapter'DRF_AUTO_BASE_SERIALIZER='htmx_renderer.serializers.HTMXModelSerializer'DRF_AUTO_BASE_VIEWSET='htmx_renderer.views.ModelViewSet'REST_FRAMEWORK={'DEFAULT_RENDERER_CLASSES':['htmx_renderer.renderers.TemplateHTMLRenderer','rest_framework.renderers.JSONRenderer',],'DEFAULT_PAGINATION_CLASS':'rest_framework.pagination.PageNumberPagination','PAGE_SIZE':50,}Addhtmx_rendererin toINSTALLED_APPS:INSTALLED_APPS=[...# API'rest_framework','drf_auto_endpoint','htmx_renderer',# TEMPLATES'bootstrap5','mathfilters',]URLsAdd this to the mainurls.pyfromdrf_auto_endpoint.routerimportrouterurlpatterns=[...path('api/v1/',include(router.urls)),...]Getting startedCreate an endpoint for your modelInside<your_app>/endpoints.pycreate an endpoint:fromdrf_auto_endpoint.endpointsimportEndpointfromdrf_auto_endpoint.routerimportregisterfrom.modelsimportMyModel@registerclassMyModelEndpoint(Endpoint):model=MyModelRestart Django's development serve and point it tohttp://localhost:8000/api/v1/For further customization of your endpoint, refer toDRF-Schema-Adapter's documentationBuildingThis project uses standardizedpyproject.tomlfor the package. To build it simply invokepython -m build(note, you may need to installbuildpackage first).To install package in development mode you can usepip install -e .DevelopmentSample (demo) appOne way to start the development is to run our demo app
and explore examples.
Source code is available insamplesubdirectory.Create migrationspython manage.py migrateStart development serverpython manage.py runserver
Package: drf-http-response
DRF http responseA DRF http custom responseDescriptionThis a http response package for django rest framework custom response. This is only for any django projects which used drf for http response.DependenciesDjago
DRFUsesInstall it by runingpip install drf-http-responseImport into your projectfrom drf_http_response import success, result, errorUse it in your http responsereturn success.get_response(message='Successfully Completed', status=200)If you use any type of response without passing parameter into it. No problem it will always return a default message. Forresult.get_response()you can pass data or object as a message into it.
Package: drf-ignore-slash-middleware
# drf-ignore-slash-middlewareDjango middleware that makes urls ending with and without slashes equivalentWhen using [DRF](https://www.django-rest-framework.org) routers you have a choice to either have urls end with trailing slash (default) or not.i.e `DefaultRouter(trailing_slash=False)`. You can't however have it both ways, as in ignore them.This package defines a very simple middleware class that removes trailing slashes from urls if they have one.So in order to ignore trailing slashes and have `/api/some_url` be equivalent to `/api/some_url/` simply install the package and add the middleware class as the first entry in the MIDDLEWARE list. Please note that middleware [changed in django 1.10](https://docs.djangoproject.com/en/1.10/topics/http/middleware/) and this this pacakge requires django version >= 1.10.```pythonMIDDLEWARE = [# Should be first entry'drf_ignore_slash_middleware.SlashIgnoreMiddleware',# Rest of your middleware]```
Package: dr-files
DR FilesRead and convert MECHBASE files (.dr) to known file formatsMECHBASEMECHBASE® is a complete preventive solution that was developed byArpedon, P.C., in order to help you store and trend your equipment status.MECHBASE files formatMECHBASE files have the following structure:2 bytes - the size of the header in bytes, in little-endian short integer formatnext N bytes - the header, inthis protobuf formatremaining bytes - the values of the signals, with each value represented in 2 bytes, like below (signal has 3 channels in this example):next 2 bytes - first value of the first channel, in little-endian short integer formatnext 2 bytes - first value of the second channel, in little-endian short integer formatnext 2 bytes - first value of the third channel, in little-endian short integer formatnext 2 bytes - second value of the first channel, in little-endian short integer formatnext 2 bytes - second value of the second channel, in little-endian short integer formatnext 2 bytes - second value of the third channel, in little-endian short integer format...Converting values to actual measured valuesdivide the value by the maximum short value (32767)multiply the value with the channel reference valueadd the channel offset to the valuemultiply the value with 1000 and divide by the channel sensitivity valueif channel db_reference exists and is positivemultiply the log10 of the absolute value divided by the db_reference with 20 -20 * log10(abs(value) / db_reference)add the channel pregain to the valueReference code can be found in thevalue_converterfunction.
Package: drf-imgproxy
Serialize Django’s ImageField intoimgproxyURLs for your Django REST
Framework APIs to generate thumbnails.Important NoticeThis package only provides the serializer class necessary to translate
your ImageField to signed imgproxy URLs.It does not provide anything to upload images to your object storage
bucket. We suggest you use another Django storage backend library
that’s able to communicate with your object storage solution, in
particular we recommend the following:django-storagesdjango-minio-storageUsage0. InstallationYou can easily install this package from PyPI withpipby doing:pipinstalldrf-imgproxy1. QuickstartInsettings.py:INSTALLED_APPS=[...'drf_imgproxy',...]# Configure this to either of the following:#  - 's3' for Amazon S3, Minio and any other S3-compatible object#    storage#  - 'gs' for Google Cloud Storage#  - 'abs' for Azure Blob StorageIMGPROXY_PROTOCOL='s3'# Set the following to the bucket name that imgproxy uses.IMGPROXY_BUCKET_NAME='nerv_angel_captures'# Set both of the following to the appropiate values of# `IMGPROXY_KEY` and `IMGPROXY_SALT` of your imgproxy server.IMGPROXY_KEY='ThisIsNotASecureKeyAtAll'IMGPROXY_SALT='SeriouslyThisSaltIsVeryInsecure'# Set the following to the publicly accessible URL of your imgproxy# server.IMGPROXY_HOST='https://imgproxy.infra.nerv.tld'# Set the following variable to the available resolutions your API# provides.## The format is `(<width>, <height>)`.IMGPROXY_RESOLUTIONS=((640,480),(800,600),(1024,768),)# In case you want to skip imgproxy url generation, set this flag to True.# When generation is being skipped, all the resolutions return the url of# the source file if possible or None.IMGPROXY_SKIP=FalseInserializers.py:...fromdrf_imgproxy.serializersimportImgproxyResizeableImageField...classAngelActivity(ModelSerializer):...captured_photo_thumbs=ImgproxyResizeableImageField(read_only=True,source='captured_photo')...See alsodrf-imgproxy-demo
Package: drf-insights-pagination
DRF Insights PaginationA simple library to add a paginator to DRF that follows Insights IPP-12.Installation and UsageInstall the librarypip install drf-insights-paginationChange your pagination class, and optionallyAPP_PATHin your settingsREST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'drf_insights_pagination.pagination.InsightsPagination',
}
INSIGHTS_PAGINATION_APP_PATH = '/api/application'
Package: drf-io-serializers
Generic views, viewsets and mixins that extend the Django REST Framework ones
adding separated serializers for read and write operations.DocumentationThe full documentation is athttps://drf-rw-serializers.readthedocs.org.LicenseThe code in this repository is licensed under the MIT unless
otherwise noted.Please seeLICENSE.txtfor details.How To ContributeContributions are very welcome.Issue report template should be automatically applied if you are sending it
from github UI as well; otherwise you can find it atISSUE_TEMPLATE.mdReporting Security IssuesPlease do not report security issues in public. Please emailcontact@vinta.com.br.Getting HelpHave a question about this repository? Please create an issue!Commercial SupportThis project, as other Vinta open-source projects, is used in products of Vinta
clients. We are always looking for exciting work, so if you need any commercial
support, feel free to get in touch:contact@vinta.com.brCopyright (c) 2020 Vinta Serviços e Soluções Tecnológicas LtdaChange LogUnreleased[1.0.5] - 2022-03-02AddedSupport Django 3.2Support Django 4.0Support Python 3.10[1.0.4] - 2020-09-02AddedMove from model-mommy to model-bakerySupport Django 3.1RemovedDrop support to Django 1.10Drop support to Python 2.7Drop support to Python 3.6[1.0.2] - 2019-08-30AddedSupport Django 2.2[1.0.1] - 2019-01-16AddedFixed bug in retrieval of success headers in create endpoints (breaking change)Updated dependencies[0.1.1] - 2018-11-12AddedSupport Django 2.1[0.1.0] - 2018-02-21AddedFirst release on PyPI.
Package: drf-ip-restrictions
DRF IP RestrictionsA library that allows IP restrictions for views/endpoints in Django REST framework.InstallationInstall using pip:pipinstalldrf-ip-restrictionsAdd the library to your INSTALLED_APPS list.INSTALLED_APPS=[...'drf_ip_restrictions',...]Override the allowed IP addresses yoursettings.pyaccording to your needs:# within settings.pyDRF_IP_RESTRICTION_SETTINGS={"ALLOWED_IP_LIST":["127.0.0.1"],}UsageAdd the AllowedIpList class to any views / endpoints that should only provide access for the
configured IP addresses, e.g. to restrict a view set:# within views.pyclassMyViewSet(viewsets.ModelViewSet):permission_classes=(AllowedIpList,)...or to restrict only a single action:# within views.pyclassMyViewSet(viewsets.ModelViewSet):...@action(detail=False,methods=["get"],http_method_names=["get"],authentication_classes=[],permission_classes=[AllowedIpList],# <-- this is the important part for IP restrictions to workurl_path=r"my-method",)defmy_method(self,request,*args,**kwargs):# do stuff and return rest_framework.response.Response in the endDjango Compatibility MatrixIf your project uses an older verison of Django or Django Rest Framework, you can choose an older version of this project.This ProjectPython VersionDjango VersionDjango Rest Framework1.0.*3.7, 3.8, 3.9, 3.103.2, 4.03.12, 3.13
Package: drf-irelation
DRF Improved RelationsWhat does it do?This package allows you to set relation from API request by primary key, object's dict, list of PKs, list of dicts of mixed list.For example{
	"name": "Quentin Tarantino",
	"person_type": {"id": 10, "name": "Director"},  // dict (field ID is only required)
	"city": 15,  // primary key
	"movies": [  // list
		15431,  // can be primary key
		{"id": 31123},  // can be dict
		{"id": 21100, "name": "Pulp Fiction"}
	]
}How to use it?RelatedFieldRelatedFieldis class implemented ofPrimaryKeyRelatedField.It has:serializerSerializer class used for serializing objects (list, retrieve...)fail_on_not_foundRaise NotFound exception if object not foundextra_filterExtra fields added to.filter()classPersonSerializer(ModelSerializer):person_type=RelatedField(serializer=TypeSerializer)city=RelatedField(serializer=CitySerializer,required=False,fail_on_null=False,fail_on_not_found=False,extra_filter={'country':Country.objects.filter(name='USA')})movies=RelatedField(serializer=MovieSerilizer,many=True)classMeta(object):model=Personfields=('id','name','person_type','city','movies')get_related_objectget_related_object(search,model,fail_on_null=True,create_on_null=False,fail_on_not_found=True,extra_filter=None)This function searchesmodelinstance bysearch(which would be primary key, dict with "id" field or list).Attributes:searchPrimary key, dict with "id" field or list of primary keysmodelModel to search infail_on_null*Raise ValidationError if search is None or incorrectfail_on_not_foundRaise ValidationError if an instance was now found (does not work with list)create_on_nullTry to create a new objectextra_filterExtra fields added to.filter()get_relation_from_requestget_relation_from_request(request,key:str,data:dict,model,fail_on_empty=False,fail_on_null=True,fail_on_not_found=True,create_on_null=False,types=None,extra_filter=None)This function gets value fromrequest, search instance byget_related_object()and put it todata.Attributes:requestHttpRequestkeyKey to get value from request datadataDict to put gotten instance inmodelModel to search infail_on_emptyRaise ValidationError if there is nokeyinrequestfail_on_null*Raise ValidationError if search is None or incorrectfail_on_not_foundRaise ValidationError if an instance was now found (does not work with list)create_on_nullTry to create a new objecttypesList of allowed value typesextra_filterExtra fields added to.filter()How to use it:defperform_create(self,serializer):data=dict()get_relation_from_request(self.request,'person_type',data,PersonType)get_relation_from_request(self.request,'city',data,City,fail_on_empty=False,extra_fields={'country':Country.objects.filter(name='USA')})get_relation_from_request(self.request,'movies',data,Movie)serializer.save(**data)
Package: drf-is-not-authenticated
Django Rest Framework Authentication Class for not authorized usersSome DRF views should not be accessible by logged in users.
In such cases we need permission class that will not allow authorized users to access the resource or action.Installationpipinstalldrf_is_not_authenticatedUse casesOnly not registered users should be able to create new userfromdrf_is_not_authenticatedimportIsNotAuthenticatedclassRegisterUser(CreateAPIView):queryset=User.objects.all()permission_classes=(IsNotAuthenticated,)Contribution