Saravanan666/pypi-org huggingface dataset:
Package: django-donottrack
Django utilities for honoring theDo Not Track HTTP header.Mathieu Leplatreposted an articleDjango: Do not forget Do Not Track. I really
appreciated the post, and wanted to implement the ideas in my projects. Being
lazy, I only wanted to do the work once, so I took his ideas and packaged them
up with some tests and docs.Included is middleware for detectingHTTP_DNTand passing its information
on to both views and templates via therequestobject, and a useful
context processor. The middleware also adds a vary header for cache control.This package requires Python 2.7 or newer and Django 1.4 or later.Refer to thedocumentationfor complete information.Quick-StartInstallation of the middleware is required. The context processor is convenient
and thus recommended.Settings:MIDDLEWARE_CLASSES = (
    # default/other processors ...
    'donottrack.middleware.DoNotTrackMiddleware',
    # default/other processors ...
)

TEMPLATE_CONTEXT_PROCESSORS = (
    # default/other processors ...
    'donottrack.context_processors.donottrack',
)Then in your template you can do things like:{% if not donottrack %}
    {% include "google-analyitcs.html" %}
{% endif %}And your views can also handle DNT:def my_view(request):
    if not request.donottrack:
        # Log some request data ...

    # continue with view logicTipAdding this app to yourINSTALLED_APPSis currently unnecessary unless
you want to run tests.Other InformationImportantInstalling this app in your Django project does not mean that you honor Do
Not Track any more than installingdjango-securemeans your web
applicaiton is secure. It only means you have some tools to help with that
end goal. You will need to audit your full stack to ensure that you are
honoring DNT. But this app is a great start, and we hope you find it
useful.NoteThis is an initial release. Despite being simple and theoretically solid
(it has a full test suite) this is a beta-type release, and the public API
may change, and as I learn more about DNT, more functionality may be added.
Package: djangodoo
Djangodoo allows you to copy models from Odoo to Django, load records from Odoo as well as modifying them. It also provides an authentication  mechanism using the Odoo authentication. This app makes a wide use of the Erppeek library.Quick startAdd “Djangodoo” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'Djangodoo',
)Include the Odoo host configuration in your project settings like this:ODOO_HOST = {
    'USER': 'username',
    'PASSWORD': 'password',
    'HOST': 'http://localhost',
    'PORT': 8069,
    'DB': 'dbname'
}[optional] Include the Odoo authentication backend in your project settings like this:AUTHENTICATION_BACKENDS = ('djangodoo.auth.OdooAuthBackend')Define a model like this:from djangodoo.models import OdooModel

class Partner(OdooModel):
    _odoo_model = "res.partner"
    _odoo_fields = ['name']  # optional; if omitted, all fields are copied
    _odoo_ignore_fields = None  # optional; fields in this list are not copiedOdooModelOdooModelinherits fromdjango.db.models.Model. You can thus do with anOdooModelanything you would do with a regulardjango.db.models.Model. However,OdooModelprovides a number of additional features:As stated in the “Quickstart” section, it allows you to provide the name of a model defined in Odoo as the value of the_odoo_modelattribute. The fields of this latter model will be copied – and “translated” – into Django fields at runtime (and during the migration process, of course) (note that amany2onefield from Odoo will be translated into aForeignKeyDjango field only if the target model of this field is also copied into Django);The_odoo_fieldsand_odoo_ignore_fieldsallow you to restrict the list of fields that are copied from the original Odoo model;Several methods that ease the interactions with the Odoo server regarding the Odoo model under concern are provided:odoo_load(odoo_ids[,client]): class method that loads records from Odoo, given their identifiers.odoo_idsis a list of Odoo records identifiers (integers);clientis an instance oferppeek.Clientthat is used to load the data; if none is provided, the client is the one configured in the settings.odoo_search(domain,offset=0,limit=None,order=None,context=None[,client]): class method that searches and loads records from Odoo, given a domain and a series of parameters for thesearchmethod in Odoo.odoo_write(objs,args[,client]): class method that writes the values provided inargsinto the Odoo records originating the Django instances provided inobjs.odoo_push(self,fieldnames=None[,client]): method that saves a Django instance into Odoo. If the instance has anodoo_idthen we callwrite, otherwise we callcreate; we only save the values of the fields indicated infieldnames, or all of them if it is None.TODOsStore the model definition and use it if no odoo server is running
Package: django-download-stats
Django Download Stats=====================A reusable Django app to keep track of file download statistics.Installation------------To get the latest stable release from PyPi::$ pip install django-download-statsTo get the latest commit from GitHub::$ pip install -e git://github.com/bitmazk/django-download-stats.git#egg=download_statsAdd ``download_stats`` to your ``INSTALLED_APPS``::INSTALLED_APPS = (...,'download_stats',)Define ``DOWNLOAD_URL`` in your settings if you want to override the defaultof ``/downloads/``::DOWNLOAD_URL = "/my-download/"Add the ``download_stats`` URLs to your ``urls.py``::urlpatterns = patterns('',...url(r'^myurlname/', include('download_stats.urls')),)An important note is, that the ``download_stats.urls`` will automaticallyprepend the ``DOWNLOAD_URL`` setting. So the following urls example wouldresult in urls formatted like ``example.com/downloads/filename.jpg``considering if you would leave the ``DOWNLOAD_URL`` on its default value``/downloads/``.urlpatterns = patterns('',...url(r'^', include('download_stats.urls')),)Why this setting anyway then?Because now you will add the context processor::TEMPLATE_CONTEXT_PROCESSORS = [...'download_stats.context_processors.download_url',]This will add the ``DOWNLOAD_URL`` variable to all templates.Don't forget to migrate your database::./manage.py migrate download_statsUsage-----With our context processor adding ``DOWNLOAD_URL`` you can basically use theview that comes with download stats just like you would do it before, justreplacing ``MEDIA_URL`` with ``DOWNLOAD_URL``::<a href="{{ DOWNLOAD_URL }}files/myfile.pdf">Click to download my file</a>It will then automatically count how often ``files/myfile.pdf`` was clicked.You can then view the individual file counts in the download stats admin.Contribute----------If you want to contribute to this project, please perform the following steps::# Fork this repository# Clone your fork$ mkvirtualenv -p python2.7 django-download-stats$ python setup.py install$ pip install -r dev_requirements.txt$ git co -b feature_branch master# Implement your feature and tests$ git add . && git commit$ git push -u origin feature_branch# Send us a pull request for your feature branch
Package: django-downloadview
django-downloadviewmakes it easy to serve files withDjango:you manage files with Django (permissions, filters, generation, …);files are stored somewhere or generated somehow (local filesystem, remote
storage, memory…);django-downloadviewhelps you stream the files with very little code;django-downloadviewhelps you improve performances with reverse proxies,
via mechanisms such as Nginx’s X-Accel or Apache’s X-Sendfile.ExampleLet’s serve a file stored in a file field of some model:fromdjango.conf.urlsimporturl,url_patternsfromdjango_downloadviewimportObjectDownloadViewfromdemoproject.download.modelsimportDocument# A model with a FileField# ObjectDownloadView inherits from django.views.generic.BaseDetailView.download=ObjectDownloadView.as_view(model=Document,file_field='file')url_patterns=('',url('^download/(?P<slug>[A-Za-z0-9_-]+)/$',download,name='download'),)ResourcesDocumentation:https://django-downloadview.readthedocs.ioPyPI page:http://pypi.python.org/pypi/django-downloadviewCode repository:https://github.com/jazzband/django-downloadviewBugtracker:https://github.com/jazzband/django-downloadview/issuesContinuous integration:https://github.com/jazzband/django-downloadview/actionsRoadmap:https://github.com/jazzband/django-downloadview/milestones
Package: django-downpage
So...
obviously you are a fantastic programmer who never writes a bug
and a fantastic systems administrator who never lets your app go down.
But what about the rest of us?Sometimes the upstream app process (e.g.gunicorn)
that runs yourDjangowebsite goes down,
and your frontend webserver (e.g.nginx) has to serve a 502
error page to visitors.This gives you three options:Just use whatever the default error pages are within frontend server.
They will be very ugly and embarrassing.Create custom error pages that match your site's styling.
Perhaps you deploy them out asstaticfiles and point your frontend
server at the right location.
This starts out great,
but as you change your site styling the static error pages will get
out of sync.
You will create work for yourself to keep them updated.Use thisdjango-downpageproject!
It provides adownpagegeneratecommand which can be run
just after runningcollectstatic.
It will build static error pages from templates.
They will always be up-to-date,
but will also be available as static resources even when
the app server goes down.Usage:Before starting it is recommended to ensure thathandler404andhandler500error pages have already been configured.
Your templates from these views can serve as the basis for the
templates thatdownpagewill use.Installdjango-downpagefrom PyPI as with any
other dependendency.
To quickly get started you might run:$ pip install django-downpagealthough for production usage it would be more manageable to use
arequirements.txtor equivalent.Now edit yoursettings.pyto ensuredownpageis listed
as an installed app.
The order is not significant:INSTALLED_APPS = [
    # ...snip...
    "downpage",
    # ...snip...
]Also insettings.pyyou will need to define the list of pages
that should be built:DOWNPAGE_PAGES = [
    ("502.html", "myapp/downpage_502.html"),
    ("503.html", "myapp/downpage_503.html", {"name", "Service Unavailable"}),
    ("504.html", "myapp/downpage_504.html"),
    # ...etc...
]The first element of the tuple is the destination file that will
get built, relative to theSTATIC_ROOTdirectory.
The second element is the template name,
and is compatible with any name that can be understood by
the built-inrender(...)shortcut.
An optional third element defines extra context that will be supplied
to the template when it is rendered.At this point you need to create your templates.
A good starting point would be the pages served up for 404 or 500 errors.
You can use the same template for each generated page if you wish.
Also you can use new-style Jinja2 templates if you
have set your site up to use them.Now update whatever process you use for deployment.
You presumably already callmanage.py collectstaticas part of
this process.
Thedownpagegeneratemanagement command is best run immediately after this:# ...snip...
/path/to/virtualenv/bin/python manage.py collectstatic
/path/to/virtualenv/bin/python manage.py downpagegenerate
# ...snip...Then you need to set up your frontend server to be aware of these files.
That will vary depending on the server you use.
Package: django-downtime
## Django Downtime> Looking For Authors!  This project is currently looking for a user to take it over.  If that sounds like you, send a note to derek at stegelman dot com or open up an issue in this repository.Small, simple, app to show a down page while you make upgrades.Official Docshttp://django-downtime.readthedocs.orgInstallDjango supports versions 1.8, 1.9, 1.10, and 1.11 on Python 2 and 3.To install django-downtime:pip install django-downtimeadd to installed apps:downtimeAdd downtime middleware tothe topyour list of installed middlewares:'downtime.middleware.DowntimeMiddleware',SettingsExempted URLs:DOWNTIME_EXEMPT_EXACT_URLS = (
    '/', # exempts homepage
    '/other_location/not_down/page',
)Exempted Paths:DOWNTIME_EXEMPT_PATHS = (
    '/admin',
    '/other_location_not_down',
)Url RedirectDOWNTIME_URL_REDIRECT = “http://errors.mypage.com”TemplatesIf no URL Redirect is specified alamedefault template is rendered, this can be overridden
by specifying adowntime/downtime.htmltemplate.Management CommandsThere are two managment commands, one to take a project downpython manage.py downtime_startand one to set it back
uppython manage.py downtime_end.What happens internally when callingpython manage.py downtime_start?This sets a start date time and mark is as enabled. We call this “deployment mode”, usually called before
running a deployment script.What happens internally when callingpython manage.py downtime_end?This sets a end date time to all records that has a start date time and no end date time set and are
marked as enabled. We call this “closing deployment mode”, usually called after running a deployment script.
Package: django-dowser
AboutBased on:DowserA Django specific Dowser port.Following enhancements have been implemented on top of the original Dowser:long term historical analysis: 1m, 1h, 1d, 4w buffersoptimization by moving from lists to python dequeserver load optimization by moving charts to google chartonly superuser can view the analysis (Django specific)Screen shotFuturemove charts to javascriptmove inline html to templatesdrop Django 1.x and Python 2.x compatibilityInstallation# latest release
pip install django-dowser
# or latest master
pip install git+git://github.com/munhitsu/django-dowser.gitNext, modify project configuration.settings.pyINSTALLED_APPS += ['django_dowser']urls.pyfrom django.urls import path, include
urlpatterns += [url(r'^dowser/', include('django_dowser.urls'))]NoteUse django-dowser only on multithreaded/gevent servers. With forking, or multiple servers, each process
will have it’s own Dowser storage, so you will only get a glimpse into one process and further requests may be load
balanced to the other servers.UsageStart the project and open link:http://domain/dowser/When running in the local development mode, it is usually:http://127.0.0.1:8000/dowser/
Package: django-dpa-chile
Django Political-Administrative Division of ChileRegiones - Provincias - ComunasInformation obtained from the api of Modernization and Digital Government Unithttps://apis.digital.gob.cl/dpaPypihttps://pypi.python.org/pypi/django-dpa-chileIMPORT REMOVE OLD VERSION <= 2.0.5Force remove foreign keyDROP TABLES django_dpa_region
DROP TABLES django_dpa_provincia
DROP TABLES django_dpa_comunaInstallationinstalldjango-dpa-chileusingpippip install django-dpa-chileadddpa_chiletoINSTALLED_APPSsettings.py# …INSTALLED_APPS =[
…
‘dpa_chile’,
]# …Populatepython manage.py migrate django_dpa_chilepython manage.py populate_dpa_chileUsefrom django_dpa_chile.models import Region, Provincia, Comuna
Package: django-dpaste
WarningThis package is no longer in development. Please see the successordpaste.dpaste - code pastebin applicationOriginally inspired by dpaste.com this application adds the ability to:See the differences between snippetsA history of snippets as a treeSee your latest 25 snippets (admin setting)A huge bunch of syntax highlighters (lexers)User defined settings to change the font-family as well as font-sizesNice colorsMultilangual interfaceper-user defined expiration of snippetsInstallation:Adddpasteto your pythonpath.Adddpasteto yourINSTALLED_APPSin your django project settings.Add this line to your urlsconf:(r'^mypaste/', include('dpaste.urls')),Requirements:django-mpttfor the nested-set history treePygmentsfor syntax highlighting
Package: django-dps
DPS payment processing for django. (Almost) completely agnostic about
your models. By default, you never handle credit card details. Handles
one-off and recurring payments.Usage:You’ll need to add a few items in yoursettings.py:PXPAY_USERIDandPXPAY_KEYfor interactive payments and recurring payment setup,
andPXPOST_USERIDandPXPOST_KEYfor non-interactive and
recurring billing.You’ll also need toinclude('dps.urls')in your urls somewhere.Then, just call this function:dps.transactions.make_payment(obj, request=None,attrs={})where:objimplementsdps.models.BasicTransactionProtocolordps.models.FullTransactionProtocol.requestis a Django request object orNone.If you intend to make an interactive payment e.g. by redirecting the
user to the DPS page, then provide a request. (It’s needed to build
fully-specified URLs for DPS to redirect back to.)IfrequestisNone, the function will attempt to find and use a
stored billing token (as described in the protocol implementations indps/models.py) and make a non-interactive recurring payment.attrsis a dictionary of PxPay or PxPost request parameters to be
merged in to the transaction request to DPS.This allows you to do anything, really, as you could override default
parameters, provide credit-card details directly, specify a refund
rather than purchase – anything DPS supports.To put an accessor/relationship on your own model to its transactions,
just use GenericRelation:class MyModel(models.Model):
    ...
    transactions = generic.GenericRelation(Transaction)There’s also adps.admin.TransactionInlineAdminwhich you can use
with your own model admins like so:class MyModelAdmin(admin.ModelAdmin):
    ...
    inlines = [TransactionInlineAdmin]

admin.site.register(MyModel, MyModelAdmin)Running testsCreate a file called tests/dps_settings.py and addPXPAY_USERIDandPXPAY_KEYvalues - you’ll need valid PXPAY testing credentials.
Then, assuming virtualenvwrapper is installed:> cd path-to/django-dps
> mkvirtualenv test
> pip install requests
> ./setup.py install
> ./runtests.pyTo run the tests across all supported Python and Django versions, usetox:> cd path-to/django-dps
> mkvirtualenv test
> pip install tox
> tox
Package: django-draftjs-tools
Django Draft.js ToolsDjango Tools around DraftJS formatInstallation>pipinstalldjango-draftjs-toolsAdd it to your list of apps in DjangoINSTALLED_APPS=[...'draftjstools',...]Template TagAt the top of your template make sure to include this after the ‘extends’ tag if used.{% load draftjs_tools %}Now pass in the draft.js data to the tag to see it render on the screen in HTML.{% draftjs_render object.data %}
Package: django-dragon
Django Dragon Cache Manager 🐲A cache manager for Django admin."What did he promise you, a share of the treasure? As if it was his to give.
I will not part with a single coin! Not one piece of it!"

- SmaugInstallationInstall the package:pip install django-dragonAdddragon_cache_managerto yourINSTALLED_APPSin Django settings.Add the Dragon URLsbeforeadmin/:path('admin/dragon/', include('dragon_cache_manager.urls')),Dragon will be accessible from/admin/dragon.ConfigurationAll Dragon settings are prefixed byDRAGON_.USER_TEST_CALLBACKrequestis the only argument and is the currentRequestinstance.Callback for determining access to the Dragon pages.Should returnTrueif allowed. Otherwise,False.By default, any staff or superuser will be able to access Dragon.USER_IS_SUPERUSERIndicates if a superuser is allowed to view Dragon.Default:TrueUSER_IS_STAFFSame asUSER_IS_SUPERUSERbut for staff.Default:FalseENABLE_INDEXIndicates if the Redis key index should be shown.Default:FalseMAX_RESULTSMaximum number of results to return on a key search.Default:50Commandsload_test_cacheAdds X keys to a cache specified insettings.CACHES.For each key, a random word fromdragon/management/commands/random_words.txtwill be used as the key and value.-c/--cache- Specify the name of the cache to populate (defaults to all).-k/--keys- Specify the number items to generate (defaults to 50).
Package: django-dramatiq-charts
Draw charts bydjango_dramatiqtask history in db.Chart types:loadandtimeline.Python version3.6+LicenseApache-2.0PyPIhttps://pypi.python.org/pypi/django_dramatiq_charts/ContentsInstallationGuideConfigurationLoad chartTimeline chartRelease notesThanksInstallation$ pip install django-dramatiq-chartsRequirements:Django 2.2+dramatiq 1.11+django-dramatiq 0.10.0+GuideConfigurationAdd django_dramatiq_charts to installed apps after django_dramatiq app:INSTALLED_APPS=['django_dramatiq','django_dramatiq_charts','my_app',# ...]Add lib views to your urls:fromdjango_dramatiq_charts.viewsimportload_chart,timeline_chart,clean_cacheurlpatterns=[path('django_dramatiq_charts/load_chart/',load_chart,name='ddc_load_chart'),path('django_dramatiq_charts/timeline_chart/',timeline_chart,name='ddc_timeline_chart'),path('django_dramatiq_charts/clean_cache/',clean_cache,name='ddc_clean_cache'),# ...]Configure lib in your project settings file:ParameterDescriptionDefaultDJANGO_DRAMATIQ_CHARTS_PERM_FNusers with access to the chartsdef fn(request): return request.user.is_superuserDJANGO_DRAMATIQ_CHARTS_LOAD_QS_FILTERAdditional queryset filter for load chartNoneDJANGO_DRAMATIQ_CHARTS_TIMELINE_QS_FILTERAdditional queryset filter for timeline chartNoneDJANGO_DRAMATIQ_CHARTS_CACHE_FORM_DATA_SECMinutes to cache choices of queue and actor form fields  (False-like to disable)4 hoursLoad chartShows the number of simultaneously executed actors in each time interval on timelineTasks running more than one day are not counted (assumed to be an error).Timeline chartShows actors on timelineIf the task duration is less than a second, this task is displayed on the chart with a duration of 1 second.Release notesHistory of important changes:release_notes.rstThanksThanks to all who helped develop this library:MilkyCake,lexa2907,python,django,plotly,jquery,select2,flaticon.com
Package: django-dramatiq-email
Django Dramatiq EmailEmail backend for Django sending emails via Dramatiq.This package is tested up to Django 4.2.InstallationTo enabledjango-dramatiq-email, modify your projectsettings.py:Add"django_dramatiq_email"toINSTALLED_APPSbelow"django_dramatiq",SetEMAIL_BACKENDto"django_dramatiq_email.backends.DramatiqEmailBackend",SetDRAMATIQ_EMAIL_BACKENDto the actual email backend you want to use (SMTP, Anymail, etc),Optionally, add theDRAMATIQ_EMAIL_TASK_CONFIGdict as shown below.ConfigurationThedramatiq.actorargs (reference,user guide) forsend_emailcan be set via theDRAMATIQ_EMAIL_TASK_CONFIGdict in yoursettings.py.The default args arehere- most notably, the defaultqueue_nameisdjango_email.Example configuration (using the Retry middleware):DRAMATIQ_EMAIL_TASK_CONFIG={"max_retries":20,"min_backoff":15000,"max_backoff":86400000,"queue_name":"my_custom_queue"}Bulk emailsBulk emails are send using individual Dramatiq tasks. Doing so these tasks can be restarted individually.MaintainerTim Drijvers