Saravanan666/pypi-org huggingface dataset:
Package: django-bureaucracy
# Django-bureaucracyDjango-Bureaucracy is a small wrapper around the [bureacracy](https://bitbucket.org/maykinmedia/bureaucracy)package that can be used to generate word and pdf documents from .docx-templatesusing Mailmerge fields.## Installation:```pip install --process-dependency-links -e git+https://bitbucket.org/maykinmedia/django-bureaucracy.git#egg=django_bureaucracy-0.1```(Note that setuptools is annoying and that this doesn't work without the`--process-dependency-links` flag which is deprecated. Have fun figuring outhow to do this when it's removed.)... and then add `django_bureaucracy` to `INSTALLED_APPS`.## Usage### Example```pythonfrom django_bureaucracy.models import Document# The document model is used to store a template and render documents from a context:doc = Document(template_file=File(open('sample.docx')),type='tps_report',validate_fields=True,)doc.save()context = {'table': Table(data=[['this is the first cell of the first row', 'this is the second cell of the first row'],['the second row', 'etc'],['etc', 'etc']],headers=['header 1', 'header 2']),'image': Image('pigeon.jpg')'html': HTML("<h1>This is a header from html. And the styling works! Right?</h1><p><strong>bold</strong>-notbold</p><ul><li>hop</li><li>la</li><li>kee</li></ul>")'text': 'some text',}# return bytes of the document generated from the template file and the contextdoc_bytes = doc.render(context)# idem but for pdf bytes:pdf_bytes = doc.render(context, format='pdf')# save to a file:doc.render_to_file(context, '/path/to/file') # docxdoc.render_to_file(context, '/path/to/file', format='pdf') # pdf```### Rendering to HTTPResponse with the correct mimetype.```pythonfrom django_bureaucracy.shortcuts import render_to_downloaddef view(request)# (...)resp = render_to_download(Document.objects.get(...), context, format='docx')# or...resp = render_to_download(DocxTemplate(...), context, format='pdf')# or ...resp = render_to_download(DocxTemplate('/path/to/file', context)# or ...resp = render_to_download(DocxTemplate(file_like_object, context)return resp```### Admin IntegrationWhen the package is installed, `Document`-objects can be created in theadmin. When the `validate_fields` box is checked, the model's `clean` methodwill check the `DOCX_TEMPLATE_VARS` setting to see whether the fields inthe template file and the document type match the ones provided in the setting andraise a `ValidationError` if this is not the case.```python# in settings.pyDOCX_TEMPLATE_VARS = {'tps_report': ['image', 'table', 'html', 'text'],'letter': ['graph']}```
Package: django-business-days
django-business-daysWrapper aroundbusiness-pythonwith days in your admin.Installation$ pip install django-business-daysAdddjango_business_daystoINSTALLED_APPSHow to use itfromdjango_business_days.calendarimportget_calendarfromdatetimeimporttimedelta# Note: django applications must be ready, because# queries are made during initializationcalendar=get_calendar()# Next just use class-API from `business-python`calendar.is_business_day("Monday, 8 June 2020")input_date=Calendar.parse_date("Saturday, 14 June 2014")calendar.business_days_between(input_date,input_date+timedelta(days=7))TODO:Add tests
Package: django-business-metrics
Django Prometheus business metricsThis Django app provides a Prometheus metrics endpoint serving so-called business metrics. These are metrics that are calculated when Prometheus hits the metrics endpoint.UsageThis project usesApiVer.
Always import fromdjango_business_metrics.v0namespace and not fromdjango_business_metrics.Create aBusinessMetricsManagerobject and register some metrics:# project/business_metrics.py

from django_business_metrics.v0 import BusinessMetricsManager, users

metrics_manager = BusinessMetricsManager()

# Add a pre-defined metric
metrics_manager.add(users)

# Add some custom metrics
@metrics_manager.metric(name='name', documentation='documentation')
def my_metric():
    return 10Register a Prometheus endpoint:# project/urls.py

...
from .business_metrics import metrics_manager

...
urlpatterns = [
    ...
    path('business-metrics', metrics_manager.view),
    ...
]Setup your Prometheus agent to scrape metrics from/business-metricsendpoint.DevelopmentBase requirementsdocker, docker-composenoxpdmHandy commands for developmentpdm install --devBefore committing make sure to run:nox -s format test
Package: django-business-rules
=====Django Business Rules=====Django Business Rules is a simple Django app to support business rules.Detailed documentation is in the "docs" directory.Quick start-----------1. Add "django_business_rules" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [...'django_business_rules',]2. Include the business rules URLconf in your project urls.py like this::re_path(r'^dbr/', include('django_business_rules.urls', namespace='django_business_rules'))3. Run `python manage.py migrate` to create the dbr models.4. Run `python manage.py dbr` to generate business rules5. Visit http://127.0.0.1:8000/dbr/business-rule/ to participate in the dbr.
Package: django_busybody
django miscDocumentationThe full documentation is athttps://django_busybody.readthedocs.io.QuickstartInstall django_busybody:pip install django_busybodyAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_busybody.apps.DjangoBusybodyConfig',...)Add django_busybody’s URL patterns:fromdjango_busybodyimporturlsasdjango_busybody_urlsurlpatterns=[...url(r'^',include(django_busybody_urls)),...]FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2017-05-11)First release on PyPI.
Package: django-buttons
django-buttonsThis application provides some simple template tags to insert buttons into templates.InstallationInstall application with pypi:$pipinstalldjango-buttons# Does not installs any fontawesome -- Must be installed manually$pipinstalldjango-buttons[fontawesome4]# Installs django-fontawesome$pipinstalldjango-buttons[fontawesome5]# Installs django-fontawesome5Add application to your INSTALLED_APPS:INSTALLED_APPS=[...'buttons',...]BUTTONS_FONTAWESOME_VERSION=4# Use 5 ti use fontawesome-5 as icon libraryUse buttons in your templates{% load buttons_tags %}
 ...
 {% btn_home %}Buttons can have some parameters :url: target urltitle: displayed texticon: fa aware name, ie. 'home' forfa-homeicon_position: Position of the icon, 'right', 'left' or 'none'
(no icon displayed) ...Enjoy !
Package: django-buysafe
=====Buysafe=====Buysafe bundles SunTech BuySafe (TM) posting and receiving routines into Django forms and views, and provides an admin view for payment method management.Dependency-----------If you want to use the default product info handler, you need to use Cartridge as your ecommerce backend. If you provide your own info handler, all you need is Django.Quick start-----------1. Add :code:`buysafe` to your :code:`INSTALLED_APPS` setting:::INSTALLED_APPS = (...'buysafe',...)2. If you don't use Cartridge, add :code:`BUYSAFE_FORM_VALUES_GENERATOR` in your settings to specify a custom handler. The handler should accept :code:`**kwargs`, which contains values in the :code:`request.POST` dictionary.3. Run :code:`python manage.py migrate buysafe`.4. Go to your admin and add some payment methods.5. To pay for an order, use POST to submit a form to view:code:`buysafe_start` with the values to pass to the product info handler. The default handler needs an :code:`order_id` field. This brings up a view to initiate the payment process.6. Profit!
Package: django-bylaws
This project gives you a pluggable application for adding bylaws to a
project. It takes advantage of django_simple_history to provide
rudimentary version control of your bylaw documents and can also handle
whether users must sign them before doing various deeds on your website.InstallationPlace ‘bylaws’ in your installed apps.Add something like the following to your urls:url(r’^bylaws/’, include(‘bylaws.urls’)),Sync your DB:python manage.py syncdbOverviewBylaws are simple documents that allow you to:use markup to structure a bylaws documentkeep track of any changes anyone makesgives you easy access to the latest adopted bylaw document
Package: django-bzmon
BZMon is a Django app to provide access to system monitoring status through API.Detailed documentation is in the “docs” directory.Quick startAdd “bzmon” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'bzmon',
]Include the bzmon URLconf in your project urls.py like this:path('bzmon/', include('bzmon.urls')),Add BZMON_CONFIG to your django settings.py like this:BZMON_CONFIG = {
    "token": {
        "required": True,
        "token": "token"
    },
    "monitor": {
        "memory": True,
        "storage": True
    },
    "memory": {
        "warn": True,
        "warn_level": 500
    },
    "storage": [
            {
                "path": str(BASE_DIR),
                "warn": True,
                "warn_level": 500
            },
            {
                "path": "/unexist",
                "warn": True,
                "warn_level": 500
            }
        ],
    "contacts": [
        {
            "name": "Bo Zhao",
            "email": "bo.zhao@bz-dev"
        }
    ]
}Visithttp://127.0.0.1:8000/bzmon/?token=tokento get .
Package: django-C3PO
django-C3PO=============django-C3PO is a Django application using C3PO - module responsible for converting .po files from locale folderwith translations to .ods format and sending them to Google Spreadsheets.This Django application provides panel where user can synchronize translations with GDocs and it givespossibility to push all translations on git and checkout last commit.After synchronization django-C3PO sends post_compilemessages signal which notifies that translations are ready.Server restart is needed then to reload compiled .mo files into application.Application uses celery to prevent timeout when synchronizing translations.Be sure to properly configure it before use.django-C3PO includes custom compilemessages command called verbosecompilemessages.It is needed to write msgfmt errors on the stderr, because standard compile messagesdoes not show them.Quick start-----------1. Add "django-C3PO" to your INSTALLED_APPS setting like this:```pythonINSTALLED_APPS = (...'django_c3po',)```2. Add C3PO variable to your settings and define them. For example:```pythonC3PO = {'LANGUAGES': ['en', 'pl', 'jp'],'EMAIL': 'ttestt123321@gmail.com','PASSWORD': 'zxcasdqwe.','URL': 'https://docs.google.com/spreadsheet/ccc?key=0AnVOHClWGpLZdGRuQVlrWG5Ia3QtOHJEWWpmZVYyYnc#gid=0','HEADER': '# translated with po_translator\n','LOCALE_ROOT': os.path.join('conf', 'locale'),'PO_FILES_PATH': 'LC_MESSAGES','TEMP_PATH': 'temp','GIT_REPOSITORY': 'git@git.hiddendata.co:mnogacki/testpo.git','GIT_BRANCH': 'master','SOURCE': 'PO Translator',}```3. Include the po_translator URLconf in your project urls.py like this::```pythonurl(r'^c3po/', include('django_c3po.urls')),```4. Add post_compilemessages signal receiver for server restart:```python@receiver(post_compilemessages)def restart_server_callback(sender, *args, **kwargs):manage_path = os.path.join(settings.ROOT_DIR, '..', 'manage.py')os.system('touch ' + manage_path)```5. Configure celery in your settings:```pythonBROKER_URL = 'django://'CELERY_IMPORTS = ('test_app.models',)import djcelerydjcelery.setup_loader()```Be sure to include module with your signal receiver in CELERY_IMPORTS.6. Start the development server, visit http://127.0.0.1:8000/admin/and add permission 'django-C3PO.can_translate' to user.7. Visit http://127.0.0.1:8000/c3po/ and log in as user with can_translate permission.8. Use buttons to synchronize, make messages and git operations.-Usage-----After configuration and logging into the translator's panel, you will see basic configuration info withlink to the spreadsheet defined in settings. User can manage app translations with three actions:- Synchronize - Synchronized translations from local files with GDoc state. If project has new expressionswhich are not in the spreadsheet, GDoc is updated with this entries. Remember that after this action servershould be restarted.- Make messages - Runs makemessages command updating po files with new expressions to translate.- Publish - Pushes current po files to git repository.- Reset - Reverts current changes and checkouts project to last commit. Note that changes are also revertedin spreadsheet, so all new translations will be lost.
Package: django-ca
django-cais a tool to manage TLS certificate authorities and easily issue and revoke certificates. It is
basedcryptographyandDjango. It can be
used as an app in an existing Django project or stand-alone with the basic project included. Everything can be
managed via the command line viamanage.pycommands - so no web server is needed, if you’re happy with the
command-line.Features:Set up a secure local certificate authority in just a few minutes.Certificate revocation via CRLs and OCSP.Certificate issuance via ACMEv2, command line, web interface or REST API.Management via command line and/or via Django’s admin interface.Get email notifications about certificates about to expire.Written in Python 3.8+, Django 3.2+ and cryptography 41.0+.Please seehttps://django-ca.readthedocs.orgfor the most recent documentation.
Package: django-cab
Cab (named for the jazz bandleader and scat singer Cab Calloway) is a
Django application which allows users to post and share useful
“snippets” of code.This code is used to power the snippet sharing site, djangosnippets.orgInstallation notesCab has a couple of external dependencies:Pygmentsfor code highlighting.python-markdownfor processing snippet descriptions. Other
Python ports of Markdown will not work, since the code which
calls Markdown assumes the existence of python-markdown’s “safe
mode”.django-simple-ratingsfor item rankingdjango-taggitfor taggingdjango-haystackfor searchAdditionally, the default setup requires a few applications which are
bundled with Django itself:django.contrib.commentsto enable commenting.django.contrib.markupto handle Markdown formatting of
comments.django.contrib.syndicationto enable feeds.It’s also recommended that you havedjango.contrib.admininstalled
for ease of site maintenance.Once you’ve got those taken care of, grab a git checkout of Cab
from somewhere on your Python path:git clone git://github.com/django-de/djangosnippets.org.gitThen addratings,taggitandcabto theINSTALLED_APPSsetting
of your Django project, runmanage.py syncdb, and either put a call toinclude('cab.urls.snippets')somewhere inn your root URLConf or copy over
the URL patterns from Cab that you want to use.Note that theget_absolute_urlmethods of theLanguage,SnippetandTagmodels assume that they will live under the
URLs/languages/,/snippets/and/tags/, so if you want
them to go elsewhere you’ll need to edit those methods or ovveride
them with Django’sABSOLUTE_URL_OVERRIDESsetting.For search support you need to set up a search engine and configure haystack:# Place where search indexes are stored for snippets - should be non web accessible
HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': '/some-path/search-index',
        'STORAGE': 'file',
        'POST_LIMIT': 128 * 1024 * 1024,
        'INCLUDE_SPELLING': True,
        'BATCH_SIZE': 100,
    },
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'TemplatesThe git repo will get you a set of example templates
matching those currently in use ondjangosnippets.orgOMGWTF Tests?Yeah, there are tests now. Seehttps://travis-ci.org/django-de/django-cab
Package: django-cache
Enhancedcache_pagedecorator forDjangoviews.CompatibilityDjango-cache properly works with Django 1.8, 1.9, 1.10 and 1.11 on Python 2.7, 3.4, 3.5 and 3.6.Advantagesfixed certain amount of bugs (including#15855)support of callablecache_timeoutandkey_prefixparameterscache age can be limited by client (min cache age is manageable, default is 0)Usagefromdjangocacheimportcache_page@cache_page(cache_timeout=600)defview(request):passCombination withlast_modifiedand/oretagview decoratorsIf you planning to usecache_pageamong withlast_modifiedand/oretagthe latter must be placed aftercache_page:fromdjangocacheimportcache_pagefromdjango.views.decorators.httpimportlast_modified,etagdefetag_generator(request,*args,**kwargs):return'ETag!!'@cache_page(cache_timeout=600)@etag(etag_generator)defview(request,*args,**kwargs):passDjango SettingsDJANGOCACHE_MIN_AGE- used to set minimal age of cache. Default is 0, meaning that client can ask server to skip cache by providing headerCache-Control:max-age=0.@cache_pageparamscache_timeout. Default issettings.CACHE_MIDDLEWARE_SECONDS.key_prefix. Default issettings.CACHE_MIDDLEWARE_KEY_PREFIX.cache_alias. Default issettings.CACHE_MIDDLEWARE_ALIAS, orsettings.DEFAULT_CACHE_ALIASif set toNone.cache_min_age. Default issettings.DJANGOCACHE_MIN_AGE.Installationpipinstall--upgradedjango-cache
Package: django-cacheable-model
django cacheable modelA cacheable model for django.A generic way of creating cache keys from Django model fieldsRetrieve django models from cache with field values (cache on the way if cache missed)Retrieve all the model instances (suitable for small set of models)Support for cache aliasesSee usage example below1. Installpip install django_cacheable_model2. ConfigurationDEFAULT_CACHE_ALIASthe default cache name to use fromsettings.CACHES.
If not set default alias is name"default"and must be configured in CACHES.CACHE_SET_MANY_LIMITis chunk size for calls tocache.set_many.whenall_ins_from_cachebrings in all entries from cache, it will set each objectin chunks to control request size. Default is5i.e if there are 10 instances of a modelfrom db this config will set each of the models to the cache in two groups of5DEFAULT_AUTO_FIELD='django.db.models.BigAutoField'CACHE_DEFAULT_ALIAS='example_cache_alias'CACHE_SET_MANY_LIMIT=10CACHES={...,'example_cache_alias':{'BACKEND':'django.core.cache.backends.memcached.PyMemcacheCache','LOCATION':'memcached:11211',},...}3. UsageSee samples inexample_django_projectviews.py and models.py.3.1. Create a model that inherits from CacheableModelclassQuestion(CacheableModel):question_text=models.CharField(max_length=200)pub_date=models.DateTimeField('date published')classChoice(CacheableModel):question=models.ForeignKey(Question,on_delete=models.CASCADE)choice_text=models.CharField(max_length=200)votes=models.IntegerField(default=0)3.2. Use cache operations from django_cacheable_model.utilsfromdjango_cacheable_model.utilsimportall_ins_from_cache,model_ins_from_cache# Get all instances of model from cache (use for smaller set of models)context['choices']=all_ins_from_cache(Choice)# Get all instances with select_related and order_bychoices=all_ins_from_cache(Choice,select_related=('question',),order_by_fields=('-id',))# Get a single model. Note this method returns a list of matching objectscontext['choice']=model_ins_from_cache(Choice,{'id':5})[-1]4. LicenseApache2 License
Package: django-cacheback
What does this library do?It’s an extensible caching library that refreshes stale cache items
asynchronously using aCeleryorrqtask (utilizing django-rq). The key
idea being that it’s better to serve a stale item (and populate the cache
asynchronously) than block the response process in order to populate the cache
synchronously.Using this library, you can rework your views so that all reads are from
cache - which can be a significant performance boost.A corollary of this technique is that cache hammering can be handled simply and
elegantly, avoiding sudden surges of expensive reads when a cached item becomes stale.Do you have good docs?Yup -over on readthedocs.org.Supported versionsPython 3.6+ is supported. Django 2.0+ is supported.Do you have tests?You betcha!Can I use this in my project?Probably - subject to theMIT license.I want to contribute!Brilliant!  Here are thecontributing guidelines.
Package: django-cacheback-pozytywnie
What does this library do?It’s an extensible caching library that refreshes stale cache items
asynchronously using aCelerytask.  The key idea being that it’s
better to serve a stale item (and populate the cache asynchronously) than block
the user in order to populate the cache synchronously.Using this library, you can rework your views so that all reads are from
cache - which can be a significant performance boost.A corollary of this technique is that cache hammering can be handled simply and
elegantly, avoiding sudden surges of expensive reads when a cached item becomes stale.Do you have good docs?Yup -over on readthedocs.org.Do you have tests?You betcha!Can I use this in my project?Probably - subject to theMIT license.I want to contribute!Brilliant!  Here are thecontributing guidelines.
Package: django-cached_authentication_middleware
django-cached_authentication_middleware is a drop in replacement for``django.contrib.auth``'s built in ``AuthenticationMiddleware``. It tries topopulate ``request.user`` by fetching user data from cache before falling backto the database.Installation------------|Build Status|* Install via pypi::pip install django-cached_authentication_middleware* Configure ``CACHES`` in django's ``settings.py``::CACHES = {'default': {'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache','LOCATION': '127.0.0.1:11211','TIMEOUT': 36000,}}* Replace ``django.contrib.auth.middleware.AuthenticationMiddleware`` with``cached_auth.Middleware`` in ``settings.py``::MIDDLEWARE_CLASSES = ('django.middleware.common.CommonMiddleware','django.contrib.sessions.middleware.SessionMiddleware',#'django.contrib.auth.middleware.AuthenticationMiddleware''cached_auth.Middleware',)And you're done!Cached Auth Preprocessor------------------------Sometimes you want to preprocess to ``User`` instance before storingit into cache. ``cached_auth`` allows you to define``settings.CACHED_AUTH_PREPROCESSOR``, a callable that takes two arguments, ``user`` & ``request`` and returns a ``User`` instance.A classic example of this would be to attach ``Profile`` datato ``User`` object so calling ``request.user.profile`` does not incur adatabase hit. Here's how we can implement it... code-block:: pythondef attach_profile(user, request):try:user.get_profile()# Handle exception for user with no profile and AnonymousUserexcept (Profile.DoesNotExist, AttributeError):passreturn user# In settings.py:CACHED_AUTH_PREPROCESSOR = 'path.to.module.attach_profile'Running Tests-------------To run the test suite::python tests/runtests.pyTo run the test suite with Django custom user (this will run only on Django 1.5)::python tests/runtests_custom_user.pyChangelog---------Version 0.2.2 (2017-04-29)==================* Added compatibility with Django 1.11. Thanks @ondrejsika!Version 0.2.1=============* Better Django 1.8 compatibility.Version 0.2.0=============* Added support for Django 1.5's customer user model* Added ``CACHED_AUTH_PREPROCESSOR`` settingVersion 0.1.1=============* Fixed an error where middleware tries to call "get_profile" on AnonymousUserVersion 0.1===========* Initial release.. |Build Status| image:: https://travis-ci.org/ui/django-cached_authentication_middleware.png?branch=master:target: https://travis-ci.org/ui/django-cached_authentication_middleware
Package: django-cache-decorator
Easily add caching to functions within a django project.## Installation from PyPi```pip install django-cache-decorator```## Installation from Github```pip install -e git+https://github.com/rchrd2/django-cache-decorator.git#egg=django-cache-decorator```## Example usage```@django_cache_decorator(time=0)def geocodeGooglePlaceTextJson(location):...```## Running tests```python -m unittest tests```## CreditsBuilt off of example code from:http://james.lin.net.nz/2011/09/08/python-decorator-caching-your-functions/Further development and packaging by Richard Caceres (@rchrd2)## Release log- 0.4 - Update project for PyPi (pip install django-cache-decorator)!- 0.3 - another bug fix for unicode params- 0.2 - bug fix for unicode params- 0.1 - initial release