Saravanan666/pypi-org huggingface dataset:
Package: django-rdtwt
django-rdtwt(Run Django Tests With Testcontainers)This focuses on users who wish to forget setting up a database for tests.
There's no need for manually starting upDocker composeor local database with this.Note:See:Altering settings at runtime: Django documentationBy default, this test runner changesdefaultdatabase host and port dynamically,
because it's quite hard to know database host beforehand in dynamic environments, for example, some CI/CD runners.Still, this just works and is quite simple, that's why I haven't spent that much time investigating alternative solutions.InstallationAdd rdtwt to your INSTALLED_APPS setting like thisINSTALLED_APPS=[...'rdtwt',]Run tests with rdtwt runner,pythonmanage.pytest--testrunner=rdtwt.runner.PostgresDiscoverRunnerThough what I really suggest is to put the following in your test settings.# RDTWT SETTINGSRDTWT_POSTGRESQL_IMAGE='postgres:14.1'TEST_RUNNER='rdtwt.runner.PostgresDiscoverRunner'This makes sure that tests run against the PostgreSQL version defined by you.
It also adds up to the test confidence; at least they aren't flaky because of a database version changing without your knowledge.Example:Defining all available options.# DatabaseDATABASES={'default':{'ENGINE':'django.db.backends.postgresql','NAME':'postgres','USER':'postgres','PASSWORD':'postgres','HOST':'127.0.0.1','PORT':'5432'}}# RDTWT SETTINGSRDTWT_POSTGRESQL_IMAGE='postgres:14.1'TEST_RUNNER='rdtwt.runner.PostgresDiscoverRunner'RDTWT_DATABASES=["default"]# Add more if you have multiple databasesRDTWT_POSTGRESQL_USER='postgres'RDTWT_POSTGRESQL_PASSWORD='postgres'RDTWT_POSTGRESQL_NAME='postgres'
Package: django-react-app
django-react-appdjango-react-app is a react application already configured to be used in a django project as a django application.Quick startInstallpip install django-react-appAdd "django_react_app" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [
        ...
        'django_react_app',
    ]Include the django_react_app URLconf in your project urls.py like this:path('', include('django_react_app.urls')),ConfigurationTo have django-react-app on your root projectYou will find the django_react_app inside your <virtualenv_name>/lib/<python_ver>/site-packages/ folder move the django_react_app folder to your root projectInstall React dependenciesOpen a terminal and go to the django_react_app folder, to install react dependencies run :npm installAfter that to run the React app you can run:npm run devRun your django appStart your django development server in another terminal and visithttp://127.0.0.1:8000/to view your react app application running
Package: django-react-appshell
Django React AppShellDjango React AppShell is a framework allows you to build a React frontend for your Django application.Unlike other approaches, this framework allows you to use Django URL routing, views, and forms. React is used instead of Django templates.InstallationInstalldjango-react-appshellwith pip:pip install django-react-appshellAdd it toINSTALLED_APPS:# settings.pyINSTALLED_APPS=[# ...'appshell',# ...]UsageSee theexample projectfor a usage example.
Package: django-react-bridge
Django React BridgeThink at Create React App but for DjangoInstallationpipinstalldjango-react-bridgeConfigurationAddreact_bridgeto the installed apps:INSTALLED_APPS=(# ...'react_bridge',)Add the react components context processor:TEMPLATES=[{# ...'OPTIONS':{'context_processors':[# ...'react_bridge.context_processors.react_components',],},},]Configure react bridge:REACT_BRIDGE_JS_CONFIG={# Should use yarn or npm? default: True'use_yarn':True,# Path of your npm_command or yarn command according to use_yarn default: yarn'npm_command':'/bin/path/to/my/yarn/or/npm',# Path of package json where js is installed default: None your should configure your own'package_json_path':os.path.join(BASE_DIR,'js'),# Path of bundler output default: package_json_path + '/static/build''output_path':os.path.join(BASE_DIR,'static/build'),# Url where the bundler output is server default: '/static/build/''output_url':'/static/build/',# Webpack entry: https://webpack.js.org/configuration/entry-context/#entry# default: package_json_path + '/src/index.js''entry':os.path.join(BASE_DIR,'js/src/index.js'),# Webpack resolve: https://webpack.js.org/configuration/resolve/#resolve# default: None'resolve':{'alias':{'@components':os.path.join(BASE_DIR,'shared/components'),}},}# Use js bridge in dev modeREACT_BRIDGE_DEV=TrueTo usedjango-react-bridgein non standard paths you should
include your top static in yourSTATICFILES_DIRSor your can changeoutput_pathaccording to your staticfile configuration.STATICFILES_DIRS=[os.path.join(BASE_DIR,'static'),]To install al required node packages needs to rundjango-react-bridgerun:pythonmanage.pyjsinitpath/to/my/js/projectThis commands install all for you and when finished print on console a baseREACT_BRIDGE_JS_CONFIGwith adjusted path related to initial given project path.UsageInside your entry javascript file:importReactfrom'react'importReactDOMfrom'react-dom'import{registerComponents}from'django-react-bridge'importMyComponentfrom'./MyComponent'registerComponents({React,ReactDOM,components:{// Register here yuor componentsMyComponent,}})Inside your Django template:{% load react_bridge %}<html><head>{% react_head_tags %}</head><body>{% render_component "MyComponent" in_tag='div' myPropA='a' myPropB='b' %}

    {% react_body_tags %}</body></html>Multi bundle set up:If you need to split your app in multiple bundles:REACT_BRIDGE_JS_CONFIG={'entry':{'frontend':os.path.join(BASE_DIR,'front/src/index.js'),'admin':os.path.join(BASE_DIR,'admin/src/index.js'),}}Then in your template you need to pass the bundle name when render related tags:{% load react_bridge %}<html><head>{% react_head_tags 'admin' %}</head><body>{% react_body_tags 'admin %}</body></html>CommandsNOTE:Before run these commands you should runjsinitto install al relative
packages needed to run js build tools.jsdevserverStart dev server on port 9000.You should haveREACT_BRIDGE_DEV = True.pythonmanage.pyjsdevserverjsbuildBuild your js and realted assets according to yourREACT_BRIDGE_JS_CONFIG.pythonmanage.pyjsbuildjsinitInit a js project at given path.pythonmanage.pyjsinitpath/to/my/js/project
Package: django-react-cms
==========Django React CMS==========.. image:: https://img.shields.io/codeship/468bb4d0-7850-0134-a43d-7aa8687239c4/master.svg?style=flat-square.. image:: https://img.shields.io/codecov/c/github/OpenVolunteeringPlatform/django-ovp-uploads.svg?style=flat-square:target: https://codecov.io/gh/OpenVolunteeringPlatform/django-ovp-uploads/.. image:: https://img.shields.io/pypi/v/ovp-uploads.svg?style=flat-square:target: https://pypi.python.org/pypi/ovp-uploads/This module implements core upload functionality.Getting Started---------------Requirements""""""""""""""You'll need a django project with admin enabled.Installing""""""""""""""1. Install django-react-cms::pip install django-react-cms2. Add `react_cms` to `INSTALLED_APPS` on `settings.py`Contributing---------------Please read `CONTRIBUTING.md <https://github.com/leonardoarroyo/django-react-cms/blob/master/CONTRIBUTING.md>`_ for details on our code of conduct, and the process for submitting pull requests to us.Versioning---------------We use `SemVer <http://semver.org/>`_ for versioning. For the versions available, see the `tags on this repository <https://github.com/leonardoarroyo/django-react-cms/tags>`_.License---------------This project is licensed under the MIT License see the `LICENSE.md <https://github.com/leonardoarroyo/django-react-cms/blob/master/LICENSE.md>`_ file for details.
Package: django-reactify
Django Reactify is an app that allows developers to add and use React components in their Django app without using the legacycreate-react-app.Quick startInstall the package via the following command:pip install django-reactifyAdd “reactify” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'reactify',
]Run the following command:python manage.py reactify <app_name>Ensure that the templates directory exists in the specified app name.Replace the app name with the existing Django app you want to reactify.This command does the following:Creates barbel and webpack configuration files in the app’s root directory.Creates package.json file with the scripts to run React development server.Creates a react folder directory with the necessary files and subdirectories where you can add your react component files and redux actions and reducers.Creates a react folder directory with the necessary files and subdirectories where you can add your react component files and redux actions and reducers.Installs the basic npm development packages.starts the react development server that listens on the changes made to the react components and compile a minimal js file that is rendered to the view.cd to the django app directory and run the following command:npm run devAdd the new view function to the views file to render the compiled version of the react app.def index(request):template_name = ‘<app_name>/index.html’return render(request, template_name)Add more React components to the react app’s component folder.Managing React RoutesIf you don’t configure Django urls to accept the Routes declared in the react, you will encouter 404 error.To fix this, lets say you have react routes as follows:<Switch><Route exact path=”/” component={Main} /><Route exact path=”/login” component={LoginPage} /><Route exact path=”/services” component={ServicesPage} /><Route exact path=”/about” component={AboutPage} />In the app urls file usere_path,from django.urls import re_pathfrom .views import indexurlpatterns = [re_path(r’’, index, name=”home”),
]
Package: django-reaction-system
InstallationInstall using pippython-mpipinstalldjango-reaction-systemor Clone the repository then copyreactionfolder and paste in
project folder.gitclonehttps://github.com/mahyar-amiri/django-reaction-system.gitConfigurationAddreaction.apps.ReactionConfigto installed_apps afterdjango.contrib.authin thesettings.pyfile. AddMEDIA_URLandMEDIA_ROOT.# setting.pyINSTALLED_APPS=['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',# MY APPS'reaction.apps.ReactionConfig',]...MEDIA_URL='/media/'MEDIA_ROOT=BASE_DIR/'media'Addpath('reaction/',include('reaction.urls')),and media root to
urlpatterns in the projecturls.pyfile.# urls.pyfromdjango.urlsimportpath,includefromdjango.confimportsettingsfromdjango.conf.urls.staticimportstaticurlpatterns=[path('reaction/',include('reaction.urls')),]urlpatterns+=static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)Connectreactionto target model. Inmodels.pyadd the fieldreactionsas a GenericRelation field to the required model.NOTE:Please note that the field name must bereactionsNOTreaction.# models.pyfromdjango.dbimportmodelsfromdjango.contrib.contenttypes.fieldsimportGenericRelationfromreaction.modelsimportReactionclassArticle(models.Model):title=models.CharField(max_length=20)content=models.TextField()# the field name should be reactionsreactions=GenericRelation(Reaction)Do migrationspythonmanage.pymigrateUsageIn the template (e.g. post_detail.html) add the following template
tags where obj is the instance of post model.{% load reaction_tags %}Add the following template tag to load stylesheet.{% render_reaction_import %}Add the following template tags where you want to render reactions.{% render_reaction request obj settings_slug='default-config' %}  {# Render all the reactions belong to the passed object "obj" #}if your context_object_name is notobj(e.g. article) replace obj
with context_object_name.{% render_reaction request obj=article settings_slug='default-config' %}Addrender_reaction_scripttag at the end of the lastrender_reactiontag.{% render_reaction_import %}

{% render_reaction request=request obj=article settings_slug='default-config' %}
{% render_reaction request=request obj=article settings_slug='second-config' %}

{% render_reaction_script %}
Package: django-reactive-framework
A minimalistic reactive framework for Django Templates.This project brings Svelete-like thinking for Django Templates.
The computation starts at the backend and continues in the frontend.This project is licensed under the MIT License.This project is experimental and under development.RequirementsThis package requires:Python>=3.8 (tested in 3.8, 3.9 & 3.10.0-rc.2)Django>=3.1 (tested in 3.1, 3.2 & 3.2.7)InstallationYou can install this package by two ways:The easy way - Type the following to a command line:pip install --upgrade https://github.com/Tal500/django-reactive-framework/archive/master.zipThe deep way (for internal development):Clone the package:git clone https://github.com/Tal500/django-reactive-framework.gitAdd the path for the repository directorysrcto your system PYTHONPATH.
This way, the python package, which is insrc/django_reactive, will be visible.Kepp in mind that this package is still under development.ExampleYou can start see an example by either one of these three methods:(Recomended) Browse the live example in Heroko (might take time to wake up):https://django-reactive-example.herokuapp.comStarting the example server:Open the command line in the root directory and execute the following:python example/manage.py runserverYou may ignore the following migration warning, since we don't use database at all:You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
 Run 'python manage.py migrate' to apply them.Open your browser and browse to:http://127.0.0.1:8000/Import the example urls to your server (listed insrc/django_reactive_framework/urls.py):Add the following patterns to yout urls.py:urlpatterns += [
     path('reactive_example/', include('django_reactive_framework.urls'))
 ]Then, the example will be in the pathreactive_example/example/in your server.Look more atsrc/django_reactive/templates/reactive_example.htmlfor the source of the example.CommunicationFor any communication you may start a discussion or report an issue in the GitHub page:https://github.com/Tal500/django-reactive-framework
Package: django-reactjs
*THIS MODULE IS DEPRECATED*# django-reactjs #A simple templatetag to load reactjs libraries.## install ##Just include `reactjs` into your `INSTALLED_APPS````#!pythonINSTALLED_APPS += [ "reactjs" ]```## templatetag ##Load the templatetag```#!html{% load reactjs %}```### reactjs ###Include the reactjs file(s) as `<scrip...></script>` tag(s).```#!html{% reactjs %}```### reactjs-with-addons ###Include the reactjs-with-addons file(s) as `<scrip...></script>` tag(s).```#!html{% reactjs_with_addons %}```### CHANGES ###0.4.1=====* update to reactjs 15.3.2* update README0.4.0=====* renamed reactjs.apps.Config to reactjs.apps.ReactJSConfig* update to reactjs 15.3.1* removed python2 support
Package: django-react-templates
React Templates is a Django app made to integrate React into Django Templates.Installationpip installdjango-react-templatesUpdate yourwsgi.pyfile with:importosfromdjango.core.wsgiimportget_wsgi_applicationfromreact_templates.wsgiimportget_web_applicationos.environ.setdefault("DJANGO_SETTINGS_MODULE","main.settings")application=get_wsgi_application()web_application=get_web_application()# Make sure this is after the applicationOncerunservercommand is called, React Templates will setup it’s necessary files and packages.Important FilesReact Templates creates several files inside your root:package.json- For managing the React packages, you can also install your own packages inside.yarn.lock- Lockfile for your packages..babelrc- Configuration file for Babel compiler.Removing any of these files (or altering .babelrc) will result in unpredicted results or failure.Quick StartInside any app in your project, create awebfolder and a.jsfile.// File inside /my-app/web/HelloWorld.jsimportReactfrom"react";functionHelloWorld(){const[number,setNumber]=React.useState(0);return(<div><h1>HelloWorld!{number}times!</h1><buttononClick={()=>setNumber(number+1)}>Clickme!</button></div>);}exportdefaultHelloWorld;// Defines which component will be rendered as an entrypoint.Once you have your React Component, create a view that renders that template:# File inside /my-app/views.pyfromreact_templates.renderimportrender_reactdefhello_world_page(request):returnrender_react(request,"my-app/HelloWorld.js")# Notice you must not mention the web folder!Now you can path it to some url and it will render a html page!ImportingImporting components from your own project must be done using the relative path from it. For example, if we have a component in a different app:// File inside /my-app/web/Home.jsimport{OtherComponent}from"../../../new-app/web/components/OtherComponent.js";...ContextYou can pass a context to the main component and it’ll be received as a prop....defmy_view(request):returnrender_react(request,"my-app/MyComponent.js",{"name":"Breno Gomes"})functionMyComponent({name}){return<h1>{name}</h1>}The code above will render a title with the name “Breno Gomes”.
Package: django-react-templatetags
Django-React-TemplatetagsThis django library allows you to add React (16+) components into your django templates.FeaturesInclude react components using django templatetagsUnlimited amount of components in one viewSupport custom models (that is from the beginning not json-serializable)Server side rendering withHypernovaorHasturInstallationInstall the library with pip:$ pip install django_react_templatetagsWhere to go from here?You should first readGetting started, then go through these topics:SettingsHow to use the templatetags included in this libraryAdding a single componentAdding multiple componentsExamplesWorking with modelsServer side renderingFAQTestsThis library include tests, just runpython runtests.pyYou can also run separate test cases:python runtests.py tests.test_filters.ReactIncludeComponentTestCoverageMake sure you have Coverage.py installed, then runcoverage run runtests.pyto measure coverage. We are currently at 95%.ContributingWant to contribute? Awesome. Just send a pull request.SecurityIf you believe you have found a security issue with any of our projects please email us atsecurity@frojd.se.LicenseDjango-React-Templatetags is released under theMIT License.
Package: django-react-tools
![Upload Python Package](https://github.com/renderbox/django-react-tools/workflows/Upload%20Python%20Package/badge.svg)# django-react-tools
Tools for helping integrate ReactJS into a Django project.The current iteration of this tool adds a simple management command to your Django project that will build, copy to a Django static directory and rename accordingly.If you wish to contribute, please Fork the repo and then make a Pull Request.  We’re always open for people who want to help make this a better package.To start run`bash pip installdjango-react-tools`then add ‘reacttools’ to your django project’s list of apps.next in settings, set where to find the React project:`python REACT_PROJECT_DIRECTORY = "/path/to/project" `The default destination location is the Static Root directory for your Django project.  You can change it by modifying the setting variable.`python REACT_DJANGO_DEST = settings.STATIC_ROOT `To run all you need to do is call the management command.`bash > ./manage.py collectreact `By default the React project is buit using “yarn build”.  If you want to change the command you can:`python REACT_BUILD_COMMAND = "npm build" `If you want to skip the build you can run the comman this way:`bash > ./manage.py collectreact--no-build`
Package: django-react-views
Django-React-Viewsdjango-react-riews is a Django app providing generic Class Based views and template tags that make it easy to use react
alongside django views and templates.It can be used along withchannels-redux-pythonandchannels-redux-jsto provide a framework to use websockets to keep
a frontend redux state in sync with the database state.Quick startAdd "django_react_views" to your INSTALLED_APPS setting like this::INSTALLED_APPS=[...'django_react_views',]Create a directory in your app calledreactCopywebpack.config.jsor use you're own webpack config as long as it builds your react components into one of your STATICFILES_DIRSUse npm to installat leastthe packages required for react & building with webpacknpminstall--save-prodreactreact-dom
npminstall--save-devbabel-corebabel-loaderbabel-preset-envbabel-preset-es2015babel-preset-reactglobwebpackwebpack-cliAdd these scripts topackage.json"scripts":{"build":"webpack","watch":"webpack --watch"},Executenpm run watchto start building your react filesAdd the react template tag to the template where you want to show your react component{% load react %}
...
{% react %}
...Create a view for your templatefromdjango_react_views.viewsimportReactDetailViewclassMyReactView(ReactDetailView):react_component='MyReactComponent.js'# By default this will resolve to dist/app_name/{react_component}. If {% static %} can not find the file you may need to edit some other properties of this classmodel_serializer=MyModelSerializermodel=MyModelAdd a url for your viewurlpatterns=[...path('my-react-view/<int:pk>/',MyReactView.as_view(),name='my-react-view')]This framework provides window.props, which contains a javascript object that can be used to hydrate your react state. This has the shape of::window.props={"objects":{"appname.modelname":{"https://example.com/appname/modelname/1/":{objectasserializedbyyourmodelserializer}}}}Start the development server and visithttp://127.0.0.1:8000/and visit your page to see you're react component in action
Package: django-readedit-switch-admin
django-readedit-switch-adminRead item detail first, and click the Edit switch button to turn to edit view.Installpipinstalldjango-readedit-switch-adminUsagepro/settings.pyINSTALLED_APPS=[...'django_readedit_switch_admin',...]app/admin.pyfromdjango.contribimportadminfrom.modelsimportCategoryfrom.modelsimportBookfromdjango_readedit_switch_admin.adminimportDjangoReadEditSwitchAdminclassBookInline(admin.TabularInline):model=BookclassCategoryAdmin(DjangoReadEditSwitchAdmin,admin.ModelAdmin):list_display=["pk","name"]list_editable=["name"]inlines=[BookInline]admin.site.register(Category,CategoryAdmin)Releasesv0.1.0First release.v0.1.1Fix add/change/delete permission problem in changelist view. Changelist view should obey the real permission.v0.1.2Don't check is_edit_view in getting add and delete permissions.v0.2.0App rename to django_readedit_switch_admin.v0.3.0Fix django_readedit_switch_admin.apps' verbose_name.Rename DjangoReadEditSwitchAdminMixin to DjangoReadEditSwitchAdmin. It's NOT good to add mixin suffix.v0.4.0Rename django_readedit_switch_admin.html to change_form.html, so that it can be override by other applications.v0.4.1Fix problem for all NONE DjangoReadeditSwitchAdmins.v0.4.2Fix block.super spell mistake.v0.4.3Use jquery.js shipped with django, and control js loading order.v0.4.4Fix edit problem with _changelist_filters.v0.4.5Fix has_add_permission problem.Test in Django 3.2.v0.4.6Doc update.v0.4.7Fix js error in latest django versions.
Package: django-readers
django-readersA lightweight function-oriented toolkit for better organisation of business logic and efficient selection and projection of data in Django projects.Tested against Django 3.2, 4.0, 4.1, 4.2 and 5.0 on Python 3.8, 3.9, 3.10 and 3.11.InstallationInstall from PyPIpip install django-readersDocumentationYou can read the documentation athttps://www.django-readers.org.Working on django-readersAfter cloning the repo:python-mvenvenvsourceenv/bin/activate
pipinstall-rdev-requirements.txt(the following commands assume you have the virtualenv activated)Running tests:./runtestsRunning code autoformatters:./formatWorking on the docs (built withMkDocsandMaterial for MkDocs):pipinstall-rdocs-requirements.txt
mkdocsserveCode of conductFor guidelines regarding the code of conduct when contributing to this repository please reviewhttps://www.dabapps.com/open-source/code-of-conduct/