Saravanan666/pypi-org huggingface dataset:
Package: django-remote-model
This package is used to connect two independent django projects together
via rest apis while providing the same interface that a normal django
model class will have.DependenciesThe script uses Django REST framework. You can install it by following
thistutorialInstallationpipinstalldjango_remote_modelpipinstalldjango-filterUsageThey say a good example is worth 100 pages of API documentation. so
let’s get started with an exampleWe will have two projects:The providerThe consumerwe will assume that the provider has a model that the consumer need to
access, let’s say this model is called ‘Product’.so to create the apis to make it available to the consumer to connect to
the provider we will use theProviderViewGeneratorandModelViewSetGeneratormethods from the package# provider urlsfromdjango_remote_model.provider.provider_view_setimportProviderViewGenerator,ModelViewSetGeneratorprovider_view=ProviderViewGenerator(<model_class>,'Remote-Model-Api-Key','KEY_Value')model_view_set=ModelViewSetGenerator(<model_class>,'Remote-Model-Api-Key','KEY_Value')router=SimpleRouter()router.register('api/model',model_view_set)urlpatterns=[path('api/<model>/provider/',provider_view),]+router.urlsNow that we half the apis ready, it’s the consumer turn to connect to
it, first let’s import theRemoteModelfromdjango_remote_model.remote_modelimportRemoteModelremote_model=RemoteModel(model_name,provider_url,view_set_url,Remote_Model_Api_Key,KEY_Value,has_permission=false)Explanation for the arguments: Argument | Function — | — model_name |
The name of the model provider_url | The url for theProviderViewGeneratorview_set_url | The url for theModelViewSetGeneratorRemote_Model_Api_Key | The api Key KEY_Value
| The Key has_permission | defaultFalse, Whether the model has
permissions or not (useful when using the admin)So far the following methods are testedremote_model.model.objects.all()remote_model.model.objects.get()remote_model.model.objects.filter()remote_model.model.objects.order_by()remote_model.model.objects.distinct()remote_model.model.objects.count()remote_model.model.save()remote_model.model.delete()Best PracticesIt’s better to have only one remote_model instance per api and to import
it wherever you want itTheremote_modelinstance will update the model inside of it if any
update happens in the fields from the provider but if you want to force
update it you can runremote_model.update()PermissionBy default the remote model does not have permission of its own because
it’s not generated from a migration, but you can create a migration for
it by settinghas_permissiontoTruebut bear in mind that you will need to delete those permission by hand
if you decided to change or remote the remote modelUsage with the Django AdminThe model can be used normally with the Django admin and it supports
most of the admin functionalityfromdjango.contribimportadminfrom.modelsimportremote_modeladmin.site.register(remote_model.model)
Package: django-remote-resources
Django remote resourcesSync remote API resources to Django modelsQuick startpip install django-remote-resourcesAddAbstractRemoteResourceto your model (1), and define a mapping between the fields in the remote data to your
model's fields (2), and create a custom QuerySet manager for the model, inheriting fromRemoteResourceQuerySetand
define methodget_remote_data_iterator(3). Optionally define aremote_data_key_fieldthat points to a unique
identifier on the remote data (4).classResourceMirrorQuerySet(# (3)RemoteResourceQuerySet):defget_remote_data_iterator(self,*args,**kwargs):client=RemoteClient()returnclient.get_data(**kwargs)# should return an iterator, with each item representing a page of dataclassResourceMirror(AbstractRemoteResource,# (1)models.Model):remote_id=models.CharField(max_length=255)name=models.CharField(max_length=255)email=models.EmailField()objects=ResourceMirrorQuerySet.as_manager()# (3)remote_to_model_fields_map={# (2)'id':'remote_id','name':'name','email':'email',}remote_data_key_field='id'# (4)Development and TestingIDE SetupAdd theexampledirectory to thePYTHONPATHin your IDE to avoid seeing import warnings in thetestsmodules. If
you are using PyCharm, this is already set up.Running the TestsInstall requirementspip install -r requirements.txtFor local environmentpytestFor all supported environmentstox
Package: django-removewww
Django Remove WWWis aDjangomiddlewareapplication that removes the WWW subdomain.The middleware inspects the request’s host for thewwwsubdomain, and redirects ifREMOVE_WWWisTrue. It silently passes ifPREPEND_WWWis alsoTrue. For some reason, Djangowon’t includeaREMOVE_WWWsetting. Thanks to Daniel Ryan’sGitHub Gistfor some inspiration.Package distributionCode repositoryDocumentationTestsInstall$pipinstalldjango-removewwwAdd tosettings.py.MIDDLEWARE=[# ...'removewww.middleware.RemoveWwwMiddleware',]REMOVE_WWW=TrueAdding toINSTALLED_APPSis unnecessary unless you want to run the tests.
Package: django-rename-app
django-rename-appA Django Management Command to rename existing Django Applications.Installationpip install django-rename-app.Add to your Django settings.pyINSTALLED_APPS:INSTALLED_APPS = [
    ...
    'django_rename_app',
    ...
]Usagepython manage.py rename_app <old_app_name> <new_app_name>For full detailed instructions seehttps://odwyer.software/blog/how-to-rename-an-existing-django-applicationRelease History0.1.7 (2023-11-08)Fixes for Python 3.7+.0.1.6 (2023-03-05)Fix for rename sequences, indexes, constraints and M2M tables.0.1.5 (2022-11-19)Fix NameError.0.1.4 (2022-11-17)Fix for DB tables with uppercase chars.Get content_type name from the database instead of making assumption.0.1.3 (2021-03-29)Handle table name truncation as Django does.0.1.2 (2020-06-02)When ran multiple times at the same time, Exception would raise from rename queries. Catch and log this instead of crashing.0.1.1 (2020-06-01)Documentation updates.0.1.0 (2020-06-01)Initial release.
Package: django-render-as-template
A template tag for Django that takes a string and renders as it if it was a
template. Uses the current Engine and RequestContext.Include in your template by adding{% load render_as_template %}. Use by
adding{% render_as_template some_var %}wheresome_varis a context
variable that acts as a template.Example: assume your view exposes two variables in the context:my_stringandmy_template.Then, if:my_string ==u"http://example.com/", andmy_template == u"Go to {{ my_string|urlize}}!"", andthe_views_template.html ==u"{%render_as_template my_template %}"Then final output would be:Go to <ahref="http://example.com/"rel="nofollow">http://example.com/</a>!Mixed with flatpages this lets you create powerful websites, although make sure
you trust the people who can edit those flatpages because who knows what kind
of dangerous security holes this thing will create! Also if your template
includes HTML don’t forget to mark it safe:{% render_as_template my_template|safe %}
Package: django-render-partial
Installationpip install django_render_partialAdd'django_render_partial'toINSTALLED_APPSEnsure that'django.template.context_processors.request'is inTEMPLATES['OPTIONS']['context_processors']UsageWrite a template for partial view, e.g.partial_view.html:<p>{{ arg1 }} + {{ arg2 }} = {{ result }}</p>Write a partial view:def partial_view(request, *args, **kwargs):
    result = kwargs['arg1'] + kwargs['arg2']
    kwargs['result'] = result
    return render(request, 'partial_view.html', kwargs)if you are using function-based views, or:class PartialView(TemplateView):
    template_name = 'partial_view.html'

    def get_context_data(self, **kwargs):
        result = kwargs['arg1'] + kwargs['arg2']
        kwargs['result'] = result
        return super(PartialView, self).get_context_data(**kwargs)if you are using class-based views.Add it tourls.py:url(r'^partial-view/(?P<arg1>\w+)/(?P<arg2>\w+)/$',
    partial_view,
    name='partial_view'),or:url(r'^partial-view/(?P<arg1>\w+)/(?P<arg2>\w+)/$',
    PartialView.as_view(),
    name='partial_view'),In your template:{% load render_partial %}
{% with some_var=2 %}
  {% render_partial 'partial_view' arg1=40 arg2=some_var %}
{% endwith %}Therender_partialtag would be rendered to:<p>40 + 2 = 42</p>Note that thewithtag above is not required forrender_partialto work. It is used to show thatrender_partialaccepts variables.
Every argument will be evaluated against context except for the names of
any keyword arguments.If you don’t want to expose your partial view inurls.py, you can
also use fully qualified dot separated view name:{% render_partial 'partial_test.views.PartialView' arg1=40 arg2=some_var %}
{% render_partial 'partial_test.views.partial_view' arg1=40 arg2=some_var %}IMPORTANT: the calling template must receive a context variable calledrequestcontaining the originalHttpRequest. Don’t forget to add'django.template.context_processors.request'toTEMPLATES['OPTIONS']['context_processors'].Adapted fromhttps://djangosnippets.org/snippets/1568/
Package: django-renderpdf
django-renderpdfis a Django app to render django templates as PDF files.IntroductionRendering PDFs for web developers is generally pretty non-trivial, and there’s
no common approach to doing this. django-renderpdf attempts to allow reusing
all the known tools and skills when generating a PDF file in a Django app:Use Django template files, which are internally rendered as HTML and them PDF
files.Use staticfiles app to include any CSS or image files.Simply subclass aPDFViewclass which has an interface very similar to
Django’s own built-inViewclasses.DocumentationThe full documentation is available athttps://django-renderpdf.readthedocs.io/.Licencedjango-renderpdf is licensed under the ISC licence. See LICENCE for details.
Package: django-reorder
=============================Django Reorder=============================.. image:: https://badge.fury.io/py/django-reorder.png:target: https://badge.fury.io/py/django-reorderA project that helps sorting querysets in a specific orderDocumentation-------------The full documentation is at https://django-reorder.readthedocs.org.Quickstart----------Install Django Reorder::pip install django-reorderThen use it in a project::from django_reorder.reorder import reorderTshirt.objects.order_by(reorder(size=['S', 'M', 'L']))Some more detailed examples can be foind on the :doc:`usage` page.Features--------* Can be used in ``order_by()`` and in ``annotate()`` calls.* Works across relationships.* Lets you control the sorting order of ``NULL`` values explicitly (otherwiseit can vary across databases).Running Tests--------------Does the code actually work?::source <YOURVIRTUALENV>/bin/activate(myenv) $ pip install -r requirements_test.txt(myenv) $ python runtests.pyCredits---------Tools used in rendering this package:*  Cookiecutter_*  `cookiecutter-djangopackage`_.. _Cookiecutter: https://github.com/audreyr/cookiecutter.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackageHistory-------0.2.1 (2016-09-13)++++++++++++++++++* Forgot to ``pull`` before I ``push``ed...0.2.0 (2016-09-13)++++++++++++++++++* Added ``null_first()`` and ``null_last()`` shortcuts.0.1.0 (2016-07-26)++++++++++++++++++* First release on PyPI.
Package: django-reorder-admin
Custom ordering for the apps and models in the admin app. You can also rename, cross link or exclude models from the app list.FeaturesReorder apps in admin index - this will allow you to position most used apps in top of the page, instead of listing apps alphabetically. e.g.sitesapp before theauthappRename app labels easily for third party apps without having to modify the source code. e.g. renameauthapp toAuthorisationfor the django admin app.Split large apps into smaller groups of models.Reorder models within an app. e.g.auth.Usermodel before theauth.Groupmodel.Exclude any of the models from the app list. e.g. Excludeauth.Groupfrom the app list. Please note this only excludes the model from the app list and it doesn’t protect it from access via url.Cross link models from multiple apps. e.g. Addsites.Sitemodel to theauthapp.Rename individual models in the app list. e.g. renameauth.UserfromUsertoStaffAdds all of the above to Django 3.1 Admin SidebarDocumentationThe full documentation is athttps://django-modeladmin-reorder.readthedocs.org.InstallInstall django-modeladmin-reorder:pipinstalldjango-modeladmin-reorderConfigurationAddadmin_reordertoINSTALLED_APPS:INSTALLED_APPS=(...'admin_reorder',...)Add theModelAdminReordertoMIDDLEWARE_CLASSES:MIDDLEWARE_CLASSES=(...'admin_reorder.middleware.ModelAdminReorder',...)Add the settingADMIN_REORDERto your settings.py:ADMIN_REORDER=(# Keep original label and models'sites',# Rename app{'app':'auth','label':'Authorisation'},# Reorder app models{'app':'auth','models':('auth.User','auth.Group')},# Exclude models{'app':'auth','models':('auth.User',)},# Cross-linked models{'app':'auth','models':('auth.User','sites.Site')},# models with custom name{'app':'auth','models':('auth.Group',{'model':'auth.User','label':'Staff'},)},)History0.1.0 (2014-08-01)First release on PyPI.
Package: django-replay
Django Replayis an Apache2
licensed Django application that records and replays web requests.FeaturesPure-PythonDeveloped on Python 3.7Tested on CPython 2.7, 3.4, 3.5, 3.6, 3.7 and PyPy, PyPy3QuickstartInstalling Django Replay is simple withpip:$ pip install django-replayTODO: Describe django app installation steps.TutorialTODO: Describe workflow.Reference and IndicesDjango Replay DocumentationDjango Replay at PyPIDjango Replay at GitHubDjango Replay Issue TrackerDjango Replay LicenseCopyright 2017-2019 Grant JenksLicensed under the Apache License, Version 2.0 (the “License”); you may not use
this file except in compliance with the License.  You may obtain a copy of the
License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.  See the License for the
specific language governing permissions and limitations under the License.
Package: django-replyify-oauth2
A Django wrapper for Replyify’s Python API bindings.InstallationYou can install this package by using the pip tool and installing:$ pip install django-replyify-oauth2Or:$ easy_install django-replyify-oauth2Register Your Application with ReplyifySign up for Replyify athttps://app.replyify.com/access/signupRegister your application athttps://app.replyify.com/oauth2/applications/registerSupported OAuth2 configuration is Public / Authorization code.Configure the django-replyify-oauth2 moduleFrom your previously configured app, found athttps://app.replyify.com/oauth2/applicationsadd the following to your Djangosettings.py:REPLYIFY_CLIENT_ID = '{ update me }'
REPLYIFY_CLIENT_SECRET = '{ update me }'
REPLYIFY_REDIRECT_URI = '{ update me, must match value set from previous step'
REPLYIFY_USER_ID_FIELD = 'id'  # or other primary key user field like `guid`
REPLYIFY_DENIED_REDIRECT = '/path/when/user/denies/access'  # defaults to home page

INSTALLED_APPS = [
    ...
    'replyify_oauth2',
    ...
]And add the following to yoururls.pyfrom django.conf.urls import patterns, include, url
urlpatterns = patterns(
    ...
    url(r'^replyify/', include('replyify_oauth2.urls', namespace='replyify')),
    ...
)Run migrate**$ python manage.py migrate**In templates<a href="{% url 'replyify:authorize' %}?next={% url 'home'|urlencode %}">Connect to Replyify</a>Note: you can passnextquery parameter to the authorize view to direct the user to correct page after OAuth flow has completed successfully.  Default will send user to ‘/’In views as a decorator: this will kick off the Authorization flow or Refresh request (if token is expired) and will send the user back to the original requested url on completionfrom replyify_oauth2.decorators import replyify_auth_required

@replyify_auth_required
def my_view_that_needs_replyify(request):
    ...Using the Replyify APIDocumentation for the python bindings can be found here:https://app.replyify.com/api/docshttp://replyify.com/api/docs/pythonIn the standard documentation (the first link), most of the reference
pages will have examples in Replyify’s official bindings (including
Python). Just click on the Python tab to get the relevant documentation.In the full API reference for python (the second link), the right half
of the page will provide example requests and responses for various API
calls.
Package: django-repomgmt
python-django-repomgmtThis Django app implements everything you need to create APT repositories,
buildd infrastructure as well as automatic package building.It expects access to an OpenStack Compute cloud to perform builds and uses
reprepro on the backend to manage the APT repositories, process incoming,
etc.Setting it up should be fairly simple.You need Django, django-tastypie, django-celery, sbuild and devscripts
installed.These are the configuration options you need to add to your settings.py:APT_REPO_BASE_URLThe base URL by which your repositories will be reachable.E.g. if set tohttp://apt.example.com/, it’s assumed that
your web server is configured to expose e.g. the “cisco” repository
underhttp://apt.example.com/ciscoPOST_MK_SBUILD_CUSTOMISATIONAn argv to be executed in the schroot after mk-sbuild is done.E.g. to avoid using a proxy for a apt.example.com, you can do
something like:POST_MK_SBUILD_CUSTOMISATION = [‘bash’, ‘-c’, ‘echo 'Acquire::HTTP::Proxy::apt.example.com “DIRECT”;' > /etc/apt/apt.conf.d/99noproxy’]BASE_URLThe base URL of the repomgmt app. This is used to construct URLs
where build nodes can fetch their puppet manifest.BASE_TARBALL_URLA URL where the generated tarballs can be found. The tarballs generally
land in /var/lib/schroot/tarballs, so you should configure a web server to
serve that directory at this URL.BASE_REPO_DIRThe base directory where the repositories should be kept.
Each repository will be represented by a subdirectory here.It is also expected that django-celery is already configured. This should be as simple as adding something like this near the end of your settings.py:INSTALLED_APPS += (“djcelery”, )
import djcelery
djcelery.setup_loader()BROKER_URL = ‘amqp://guest:guest@localhost:5672/’
Package: django-reportengine
Django Report Engine provides a reporting framework for Django 1.3+. Its goal
is to be lightweight, provide multiple output formats, easily integrate into
existing applications, and be open ended to both direct SQL reports, ORM based
reports, or any other type of report imaginable. It is also attempting to be
reasonably batteries-included with some basic Date based filtering assumptions,
and simple namespacing of reports.Reports are assumed to be tabular, with additional key/value “aggregates”. A
special form can be used to provide filtering/querying controls. There are
premade filtering controls/framework to assist. Existing shortcut queryset and
SQL based forms are integrated and can be quickly extended for generic reports.
CSV, XML and HTML exports are included.
Package: django-reporter-pro
Django Reporter ProSetup in your django project:Clone intodjango_reporterfolder of youproject's rootdirectorygitclonegit@github.com:shamilison/django-reporter-pro.git<reporting_cloned_folder_name>Add reporter.pth file in your python environment's site-package folder where content will beimportsys;sys.__plen=len(sys.path)/{path_to_<reporting_cloned_folder_name>}/importsys;new=sys.path[sys.__plen:];delsys.path[sys.__plen:];p=getattr(sys,'__egginsert',0);sys.path[p:p]=new;sys.__egginsert=p+len(new);Add in settings settings.pyWEBPACK_APPLICATION_STATS_PATH=os.path.join(os.path.join(BASE_DIR,'<reporting_cloned_folder_name>'),'django_report_vue','webpack-application-stats.json')# WEBPACK_APPLICATION_STATS_PATH has to be path to the file of "<reporting_cloned_folder_name>/django_report_vue/webpack-application-stats.json"WEBPACK_LOADER={'DJANGO_REPORT_PRO':{'CACHE':notDEBUG,'BUNDLE_DIR_NAME':'/bundles/',# must end with slash'STATS_FILE':WEBPACK_APPLICATION_STATS_PATH,},}Add apps in our installed app's list# Vuejs Integration Helpers'webpack_loader','corsheaders',# Reporter app'django_reporter_pro',Include urls of reporter library in your project urls.py
url(r'^', include('django_reporter_pro.urls')),These are the URLS:/django-reporter/#/build-report/create/-tocreatereport/django-reporter/#/build-report/update/{pk}/-toupdatereport/django-reporter/#/build-report/view/{pk}/-toviewthereportoutputInstall required python packages as follows:cd<reporting_cloned_folder_name>pipinstall-rpackages.txtRunpython manage.py migrateto introducedjango_reporter_promodule modelsHere<reporting_cloned_folder_name>/django_report_vueis a standalone VueJS project:
Go to<reporting_cloned_folder_name>/django_report_vueand run:npminstallnpmrunserveThis will update awebpack-application-stats.jsonfile for your django project's webpack.Use following decorator over a model to make it available for reporter:enable_for_reporter
Package: django-reportmail
Django library to send ‘report’ mail.Almost django management commands used as night batch processing,
and then, administrators will want to know the result of it as mail.At a glanceConsider a case which is for processing lines of csv by django’s management command.
And then you want to know the result of the command by mail.Just thing you should do is decoratinghandlemethod byapply_reportermethod:importcsvfromdjango.core.management.baseimportBaseCommandfromreportmail.commandimportapply_reporterclassCommand(BaseCommand):@apply_reporter("Title")defhandle(self,reporter,filepath,*args,**options):fori,linenumerate(csv.DictReader(open(filepath))):reporter.append('Line{}: processed{}'.format(i+1,l))Then, when the command finish, you’ll get a admin mail like this:Subject:
    Title
Body:
    Report of someapp.management.commands.some_of_your_command
    args: path/to/somecsv.csv
    options: settings=None,pythonpath=None,traceback=None,verbosity=1,

    result:
    Line1: processed {'somefield': 'somevalue0'}
    Line2: processed {'somefield': 'somevalue1'}
    Line3: processed {'somefield': 'somevalue2'}
    Line4: processed {'somefield': 'somevalue3'}
    ...If you like django-reportmail, please referthe documentation.
You can learn about django-reportmail enough to use it on your work.ResourcesDocumentationGithubPyPIChanges1.3 (2015-08-20)#6 Added.abort()feature for Reporter.1.2.4 (2014-11-29)#5 Officially supporting for Python3.4 and Django1.7.1.2.3 (2014-06-20)#3 Add manager_mail_committer.1.2.2 (2014-06-15)#2 Improvedapply_reporterto get a committer function.1.2.1 (2014-06-14)Cleaned up the default template of report mail.1.2 (2014-06-07)Fixed wrong function names of committer (comitter => committer)reportmail.reporter.console_comitteris now renamed asreportmail.reporter.console_committerreportmail.reporter.admin_mail_comitteris now renamed asreportmail.reporter.admin_mail_committer1.1 (2014-05-28)Fixed the wrong attribute name of Reporter (comitter => committer)1.0 (2014-05-28)Initial release
Package: django-reports
=============================django-reports=============================.. image:: https://badge.fury.io/py/django-reports.png:target: https://badge.fury.io/py/django-reports.. image:: https://travis-ci.org/grantmcconnaughey/django-reports.png?branch=master:target: https://travis-ci.org/grantmcconnaughey/django-reportsA Django app to easily create and render reports.Documentation-------------The full documentation is at https://django-reports.readthedocs.org.Quickstart----------Install django-reports::pip install django-reportsThen use it in a project::import djreportsFeatures--------* TODORunning Tests--------------Does the code actually work?::source <YOURVIRTUALENV>/bin/activate(myenv) $ pip install -r requirements-test.txt(myenv) $ python runtests.pyCredits---------Tools used in rendering this package:*  Cookiecutter_*  `cookiecutter-pypackage`_.. _Cookiecutter: https://github.com/audreyr/cookiecutter.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackageHistory-------0.1.0 (2015-10-02)++++++++++++++++++* First release on PyPI.