Saravanan666/pypi-org huggingface dataset:
Package: django-dedal
Fast CRUD builder.DocumentationThe full documentation is athttps://django-dedal.readthedocs.org.DemoExample project is available onhttp://django-dedal.herokuapp.com/.QuickstartInstall django-dedal:pip install django-dedalThen use it in a Django project simple adddedalandbootstrapform(if you want use bootstrap) toINSTALLED_APPS:INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    ...
    'dedal',
    'bootstrapform',
)After this decorate your model by@crud:from django.db import models

from dedal.decorators import crud


@crud
class Post(models.Model):
    title = models.CharField(max_length=50)
    body = models.TextField()
    comments = models.ManyToManyField('Comment', blank=True)

    def __str__(self):
        return '{}'.format(self.title)That’s all!TODOselect relatedHistory1.1.0 (2018-01-11)add paginationadd support for Django 2.xdrop support for Django 1.8 and Python 3.4fix CI1.0.1 (2016-03-30)refactored testsfixes heroku example app1.0.0 (2016-03-26)removed urls.W002 (changed URL for list)changed URL format for reverse (introduced namespace)dropped support for python 2.x0.1.0 (2015-05-09)First release on PyPI.
Package: django-dedupe-backend
If making sure your file uploads are never duplicated is more important than
organising your files into neat folders, you might want to try this package.UsageYou can use the storage backend on a global level by adding the following to
your django settings:DEFAULT_FILE_STORAGE = 'dedupebackend.storage.DedupedStorage'If you want to use the other features offered by dedupebackend, you need to add
dedupebackend toINSTALLED_APPSlike this:INSTALLED_APPS = [
    'dedupebackend',  # does not matter what spot
    ...
]Admin integrationAdding dedupebackend toINSTALLED_APPSgives you an admin page where you
can check your uploaded files. I allready let you know dedupebackend just
throws verything in a large folder, but that does not mean you can not add
structure to the storage. Just not on a filesystem level. You should add
structure by adding relations to other models. It is easy enough to add
categories or something:class FileCategory(models.Model):
    files = models.ManyToManyField('dedupebackend.UniqueFile')
    name = models.TextField()If you want to add a filter to the dedupebackend admin, try something like
this:from dedupebackend.admin import UniqueFileAdmin
from dedupebackend.models import UniqueFile

admin.site.unregister(UniqueFile)

class CategoryUniqueFileAdmin(UniqueFileAdmin):
    list_filter = UniqueFileAdmin.list_filter + ('filecategory__name',)

admin.site.register(UniqueFile, CategoryUniqueFileAdmin)that might need some work, I never tested it :pfieldsThere are some fields in dedupebackend you can use instead of the djangoFileFieldandImageField. You get a picker added to that, you can use
to select a file from the existing uploaded files.Use something like this:from dedupebackend.fields import *

class KoeHenkModel(model.Model):
    name = models.TextField()
    file = UniqueFileField("A normal file, nothing special")
    image = UniqueImageField("an image")How does it work?Well, for each uploaded file, dedupebackend creates a file on disk named after
the hash of the file. Mostly the same as git does (I actually tried to use
libgit2 for this, but git is bad with deletions). Next to that file, a table
holds a record with some information about the file. The primary key of this
table is the hash value of the file. So it is really impossible to add
duplicates (but but, hash collisions).The fields actually render a file form field on a foreign key model field.
The storage backend returns the hash value as the file name. And it can return
file objects when given such a hash value.
Package: django-deep-link
Django Deep LinkOverviewSimple app to get mobile app deep linking in place with basic tracking.DocumentationThe full documentation is at ...QuickstartInstall Django Deep Link::pipinstalldjango-deep-linkAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_deep_link',...)Add Django Deep Link's URL patterns:fromdjango_deep_linkimporturlsasdjango_deep_link_urlsurlpatterns=[...path(r"",include(django_deep_link_urls,namespace='django-deep-link')),...]Provide Your Own IP Geodata Handlerimport requests
from django.core.cache import cache

def get_ip_geodata(ip_address):
    """Use 3rd party API to obtain Geodata from a given IP."""
    if cache.get(ip_address):
        return cache.get(ip_address)

    params = {}
    r = requests.get(f"https://domain.com/{ip_address}", params=params)
    r.raise_for_status()
    cache.set(ip_address, r.json(), 60*60*24)  # 24 hrs
    return r.json()The IP geodata handler must also be configured in your settings, using theIP_GEO_HANDLERsetting key. For example:DEEP_LINK = {
    'IP_GEO_HANDLER': 'my_project.my_app.utils.get_ip_geodata'
}If not specified, the'IP_GEO_HANDLER'setting defaults to the geodata provided by Deep Link, which leveragesIP Stack:DEEP_LINK = {
    'IP_GEO_HANDLER': 'django_deep_link.helpers.ip.get_ip_geodata'
}FeaturesTODODevelopmentmake env
make reqs
pip install -e .TestingProject is at76%test coverage.python3 runtests.py

python3 -m pytest -v
tox

# Run coverage
pytest --cov-report html --cov-report term --cov=tests/IssuesIf you experience any issues, please create anissueon Bitbucket.ChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog,
and this project adheres toSemantic Versioning.[0.3.0] - 2023-06-23New packaging method usingpyproject.tomlFresh migrationsMovedmodel_utilstomixins.py[0.2.6] - 2021-08-04FixedAdded missing migrations.[0.2.5] - 2021-07-29ChangedRemoved print statementMovedget_querystring_as_dictintohelpers[0.2.4] - 2021-07-29AddedCapture query params in visit[0.2.3] - 2021-07-29ChangedDon't assume url pattern[0.2.2] - 2021-07-29AddedLink to mobile and desktop app stores.FixedBroken app store links in app listing[0.1.0] - 2021-07-23First release on PyPI.
Package: django-deep-translator
django-deep-translatorAutotranslate django.potranslation files package built on top ofdeep-translatorInstallationpipinstalldjango-deep-translatorAdd'django_deep_translator'to yourINSTALLED_APPSsetting:INSTALLED_APPS=(...'django_deep_translator',)Quickstartpythonmanage.pytranslate_messagesThe command finds all the generated pot (.po) files under the locale paths (LOCALE_PATHS) specified in django project settings, and translates them automatically with default source language asenglish.Options-f, --set-fuzzy: Set the 'fuzzy' flag on autotranslated entries-l, --locale 'locale': Only translate the specified locales-u, --untranslated: Only translate the untranslated messages-s, --source-language: Override the default source language (en) used for translationpythonmanage.pytranslate_messages-l'de'-l'es'SettingsIn your settings, list the relative path to locale folders, example:LOCALE_PATHS=('locale','home/locale','products/locale','services/locale',)Using a different Translation Service:# default: 'django_deep_translator.services.GoogleTranslatorService'PO_TRANSLATOR_SERVICE='django_deep_translator.services.GoogleAPITranslatorService'PO_TRANSLATOR_SERVICEaccepts the following services with respective additional variables:ServiceAdditional variablesDescriptionGoogleAPITranslatorService--MicrosoftTranslatorServiceMICROSOFT_TRANSLATE_KEYYou need to require an api key if you want to use the microsoft translator. Visit the official website for more information about how to get one. Microsoft offers a free tier 0 subscription (2 million characters per month).PonsTranslatorService--MyMemoryTranslatorService--YandexTranslatorServiceYANDEX_TRANSLATE_KEYYou need to require a private api key if you want to use the yandex translator. Visit the official website for more information about how to get onePapagoTranslatorServicePAPAGO_CLIENT_ID,PAPAGO_SECRET_KEYYou need to require a client id if you want to use the papago translator. Visit the official website for more information about how to get one.DeeplTranslatorServiceDEEPL_TRANSLATE_KEYVisithttps://www.deepl.com/en/docs-api/for more information on how to generate your Deepl api keyQcriTranslatorServiceQCRI_TRANSLATE_KEYVisithttps://mt.qcri.org/api/for more informationLibreTranslatorserviceLIBRE_TRANSLATE_MIRROR_URLLibre translate has multiple mirrors which can be used for the API endpoint. Some require an API key to be used. By default the base url is set to libretranslate.de .
Package: django-default-imagefield
Default static file path for Django ImageFieldSetupinstall it viapip installdjango-default-imagefieldadd it to your settings and it auto-registers itselfsettings.INSTALLED_APPS = [
   ...
   'django_fields',
   ...
]Usageadd field to your model classfrom django_fields import DefaultStaticImageField

class Post(models.Model):
  photo = DefaultStaticImageField(blank=True)default path isdjango_fields/no_image.pngand is included in the package. you can change it viasettings.py# settings.py
DEFAULT_IMAGE_PATH = 'images/custom_no_image.png'or add field attributedefault_image_pathclass Post(models.Model):
  photo = DefaultStaticImageField(blank=True, default_image_path='images/blank.png')if there is no file in thedefault_image_pathof the field orDEFAULT_IMAGE_PATHin settings.py, use the default image built into the package.if deploying to a production environment, you must run the./manage.py collectstaticcommand to copy the image files included in the package to the static file serving path.ContributingAs an open source project, we welcome contributions.The code lives ongithub.
Package: django-defaults
django-defaults===Django settings sans boilerplate[GitHub][2] ・ [PyPI][3]Installation---```shpip install -U django django-defaults```Usage---**Updating an existing Django project**1️⃣ Create a new file named `defaults.toml` (next to `manage.py`) with the following contents:```toml[django]settings-module = 'PROJECT_NAME.settings'routes-module = 'PROJECT_NAME.urls'```This is the compulsory configuration file.* `settings-module` is similar to `DJANGO_SETTINGS_MODULE`* `routes-module` is similar to `ROOT_URLCONF`2️⃣ Inject configuration variables into the current module (typically in `settings.py`)```pythonfrom defaults import emplaceemplace()```This replaces the entirety of the stock `settings.py` file, as generated by the `django-admin startproject` command.3️⃣ Optional: ensure that the `DJANGO_SETTINGS_MODULE` environment variable is set (in scripts such as `manage.py`)```pythonfrom defaults import setenvsetenv()```This replaces the `os.environ.setdefault(DJANGO_SETTINGS_MODULE)` line.**Creating a new Django project**```shURL=https://github.com/mvasilkov/django-defaults/archive/template.zipdjango-admin startproject --template $URL --extension py,toml PROJECT_NAME```See the [project template][1][1]: https://github.com/mvasilkov/django-defaults/tree/template[2]: https://github.com/mvasilkov/django-defaults[3]: https://pypi.org/project/django-defaults/
Package: django-defaultsite
Sets the Site object in django to something better then example.com. So when other apps like pinax use it to construct email links that they actually work.Installation.To install either download the source and run ‘setup.py install’ like any other python module or install it from the cheese shop with ‘easy_install django-defaultsite’Then add ‘defaultsite’ into your INSTALLED_APPS in your django settings.Configuration (Optional)By default it will use socket.gethostname() to determine the host name of the site, and ‘defaultsite’ as the human readable version.If you want to configure it further these settings are available, just put them in your settings.py:SITE_ID: The primary key on which Site object to modify. Normally 1.SITE_DOMAIN: The domain to use to replace ‘example.com’. Defaults to your machine’s hostname.SITE_NAME: The sites name. Defaults to ‘defaultsite’.
Package: django-deferred-filelogger
This package provides a new logging handler that defers evaluation of the
filepath until a message is emitted.  It uses a settingLOG_ROOTas the
folder for the log files.  This is useful when you don’t know the exact location
of your log files when theLOGGINGsetting is defined - this can be the case
if you have a environment specific settings file which gets imported after your
core settings.UsageIn your main settings file, configure your handlers with a filenameLOGGING={...'handlers':{'error_file':{'level':'INFO','class':'deferred_filelogger.DeferredFilehandler','filename':'errors.log',}},'loggers':{'django.request':{'handlers':['error_file','mail_admins'],'level':'ERROR','propagate':False}}}then in your environmental overrides (egsettings_local.py), specify aLOG_ROOTfolder.  For instance, in your test environment you might specifyLOG_ROOT='/var/www/client/project/logs/test'which would cause your Django errors to be logged to/var/www/client/project/logs/test/errors.log.
Package: django_deferred_polymorph
ABOUTdjango_deferred_polymorph is an implementation of polymorphic models for Django. Like other solutions you can just fetch the base instance from your database and get the right subclass back. This means you always can rely on having all data/methods your child class would provide.Unlike other solutions additional data is loaded by using a slightly modified version of Django’s own deferered mechanisms. This way getting the base classes issues only one SQL query, returning the subclasses with all additional data as defered field. If you attempt to access one of the deferred fields all deferred fields are loaded (unlike for Django’s default deferred fields).django_deferred_polymorph includes two abstract base models:DeferredPolymorphBaseModel as the base for every deferred modelSubDeferredPolymorphBaseModel which extends DeferredPolymorphBaseModel to force userd to use a subclassInstallationFirst:pip install django_deferred_polymorphThen add'django_deferred_polymorph'to yourINSTALLED_APPSsettings.Running testsFirst create avirtualenv, then install package inside the virtualenv and
add the test dependencies with:python setup.py develop
pip install -r requirements.txtNow you can run the test suite against the currently installed version of
Django with:python runtests.pyHowever we support multiple versions of Django and Python. To test all
relevant combinations at once you can use the following command:toxChangelog0.4.0Reuse registered apps so object deletion worksDropped compatibility with Django < 1.70.3.2Fix for Django 1.8 that did not set_base_managercorrectly for
subclasses ofDeferredPolymorphBaseModel. That broke theModel.delete()method in some cases.0.3.1Adding MANIFEST.in file to define which files get included in the source
distribution. CHANGES.rst was missing from that and caused an error on
install.0.3.0Dropping support for Django 1.5.x and lower as we had to adept to Django’s
naming scheme forget_querysetinstead ofget_query_setin managers.Fix for Django 1.8 which uses unicode for model names in the Meta._meta
object. That broke the dynamic class creation withtype().0.2.0Django 1.8 support.
Package: django-definition-tag
Allows easy creation of template tags that define a context variableThe "tag function" returns a value which, when called inside a template, is stored in avariable or displayed directly.Example:@definition_tag(register=register)def top_players(context):return TopScores.objects.order_by('-elo')[:20]Inside the template, we could call {% top_players %} to output the data, or we could call{% top_players as foo %} {{ foo }}.
Package: django-delayed-notifications
NotificationsThis application sends notifications to the user and emails addresses.
It stores messages into a database, and sends can be delayed through a cron task.Installation$pipinstalldjango-delayed-notificationsAdddjango_notificationsto yourINSTALLED_APPS:INSTALLED_APPS=(..."django_notifications",...)Apply the migrations:$./manage.pymigrateUsageInstead of sending a raw email, with thesend_maildjango function, you can create a Notification object and program
the sending.Notification creationfrompathlibimportPathfromdjango_notifications.modelsimportNotification,Attachmentfromdjango.core.filesimportFilefromdjango.utils.timezoneimportnowfromdatetimeimporttimedelta# **Basic creation**my_instance="<A random object in the application>"notification=Notification.objects.create(subject="My beautiful email",text_body="My text body",html_body="""<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="x-apple-disable-message-reformatting"><title>My beautiful email</title></head><body>My HTML body</body></html>""",from_email="foo@example.org",# Optional)# ** Related objects management **# It is possible to attach an object to the email (Optional)notification.related_object=my_instance# ** Related objects states management **# When using FSM, you can provide the states from / to (Optional)notification.state_from="active"notification.state_to="processing"# **Attachments management**_attachment=Attachment.objects.create(notification=notification,attachment_file=File(Path("<my_file>").open("r"),name="my_file.txt"))# **Recipients management**# You can provide usersnotification.recipients.set("<User instance>","<User instance>",...)notification.save()# And / Or provides email address, `\n` separatednotification.email_recipients="\n".join(["foo@example.org","bar@example.org"])notification.save()# You can set the delayed sending datenotification.delayed_sending_at=now()+timedelta(days=1)notification.save()# Or you can send the email immediatelynotification.send()Management commandThe application provides a management command to send the emails:$./manage.pysend_notifications12notificationssent.TemplatesThe application provides some basic templates for emails.AdminThis application provides an admin interface for notifications.NotesThe application is available in English and translated to French.
Package: django-delayed-union
django-delayed-unionis library designed to workaround some
drawbacks with Django’s union, intersection, and difference
operations.  In particular, once one of these operations is performed,
certain methods on the queryset will silently not work:>>> qs = User.objects.filter(id=1)
>>> unioned_qs = qs.union(qs)
>>> should_be_empty_qs = unioned_qs.exclude(id=1)
>>> user, = list(should_be_empty_qs); user.id
1In order to work around this,django-delayed-unionprovides
wrappers around a collection of querysets.  These wrappers implement a
similar interface toQuerySet, and delay performing the union,
intersection, or difference operations until they are needed:>>> from django_delayed_union import DelayedUnionQuerySet
>>> qs = User.objects.filter(id=1)
>>> unioned_qs = DelayedUnionQuerySet(qs, qs)
>>> empty_qs = unioned_qs.exclude(id=1)
>>> list(empty_qs)
[]Operations which would typically return a newQuerySetinstead
return a newDelayedQuerySetwith the operation applied to its
collection of querysets.One example of where this code has been useful with is when the the
MySQL query planner has chosen an inefficient query plan for the
queryset of aDjango REST Frameworkview
which used anORcondition.  By usingDelayedUnionQuerySet,
subclasses could perform additional filters on the queryset while
still maintaining the efficient query plan.Free software: BSD 3-Clause LicenseInstallationpip install django-delayed-unionDocumentationhttps://django-delayed-union.readthedocs.io/DevelopmentTo run the all tests run:toxChangelog0.1.7 (2022-01-12)Fixed setup.py metadata0.1.6 (2022-01-12)Added support for Django 3.2 and 4.0.Dropped Python 2 support.0.1.5 (2020-04-14)Added support for Python 3.8 and Django 3.00.1.4 (2019-10-19)Added query property to delayed querysets.Fixed bug with count() and select_related() in MySQLAdded tests for Django 3.00.1.3 (2019-04-24)Added tests for Django 2.20.1.2 (2018-12-14)Added support for nested unions and intersections0.1.1 (2018-07-16)Cached the queryset generated after applying the delayed operation.0.1.0 (2018-03-14)First release on PyPI.
Package: django-deletes
Installation Instructionspip install django-deletes # Doesnt work yet, clone the repo.Add ‘softdeletes’ to INSTALLED_APPS in settingsUsageUse Deletable class on the left most in the inhertance chain of the
model.Use objects = DeletableManager.from_queryset(DeletableQuerySet)()If you want to use a custom manager or a custom Queryset, make sure
your custom manager inherits from DeletableManagerMixin and your
custom QuerySet inherits from Deletable QuerySetMixinCautionAll cascading delete models should be made deletable, otherwise
cascading delete would do a real delete to the foreignkey related
models.
Package: django-deletion-side-effects
django-deletion-side-effectsDjango Deletion Side Effects provides a framework for gathering side effects of deleting objects in Django.InstallationTo install the latest release, type:pip install django-deletion-side-effectsTo install the latest code directly from source, type:pip install git+git://github.com/ambitioninc/django-deletion-side-effects.gitDocumentationFull documentation is available athttp://django-deletion-side-effects.readthedocs.orgLicenseMIT License (see LICENSE)
Package: django-delta-logger
Django Delta LoggerA django app that provides a model class that records changes in django models.InstallationGet the Packagepip install django_delta_loggerUpdate the Django SettingsAdddjango_delta_loggerto theINSTALLED_APPSlist.INSTALLED_APPS=[
    # ...
    'django_delta_logger',
    # ...
]Make sureJSON_ENCODERis set in the django settings. A reasonable default is provided and is directly importable into an existing settings file.from django_delta_logger.settings import JSON_ENCODERUsageDjango_delta_logger's primary API is a context manager:from django_delta_logger.delta_logger import DeltaLogger

with DeltaLogger(SomeDjangoModel, SomeOtherDjangoModel):
    foo = SomeDjangoModel(name='foo')
    foo.save()Log ResultsAccess the history of a model instance from theDeltaEventmodel.from django_delta_logger.models import DeltaEvent

instance = SomeModel.objects.get(pk=1)
events = DeltaEvent.objects.get_for_instance(instance).all()

for event in events:
    print(event.event_time, event.event_type, event.event_data)from django_delta_logger.models import DeltaEvent

events = DeltaEvent.objects.get_for_model(SomeDjangoModel).all()

for event in events:
    print(event.event_time, event.event_type, event.event_data)The Risks of ConcurrencyTracking thedirtynessof a model instance field is performant but can lead to inaccurate log data when one
model instance is edited in multiple threads/processes/servers.When data accuracy in a concurrent environment is worth the performance cost of a fetch-before-write:from django_delta_logger.delta_logger import DeltaLogger

with DeltaLogger(SomeDjangoModel, concurrent=True):
    foo = SomeDjangoModel(name='foo')
    foo.save()Test Suitepython setup.py testLicenseThis software is published under the MIT License. See theLICENSEfile
for details.