Saravanan666/pypi-org huggingface dataset:
Package: django-daterangefilter-fixed
Django admin date range filterApplication adds three Django admin list filters:DateRangeFilter,PastDateRangeFilterandFutureDateRangeFilter. These filters let user filter models by date range.PastDateRangeFilterandFutureDateRangeFilteradd quick selection of predefined date ranges. Filters can be applied to any model date fields. Application supports default Django admin theme andSuit theme.RequirementsPython 2.7+ or Python 3.3+Django 1.9+InstallationInstalldjango-daterangefilterusing pip:pipinstalldjango-daterangefilterAdddaterangefiltertoINSTALLED_APPS. Example:INSTALLED_APPS=(...'daterangefilter',...)Application uses static files so do not forget to issuecollectstaticmanagement command in production environment.Example usagein admin.py:fromdjango.contribimportadminfromdaterangefilter.filtersimportPastDateRangeFilter,FutureDateRangeFilter@admin.register(Post)classPostAdmin(admin.ModelAdmin):list_filter=[('created_at',PastDateRangeFilter),('publish_at',FutureDateRangeFilter)]Advanced usagePredefined ranges can be completely redefined by overriding_past_ranges.htmland_future_ranges.htmltemplates.
Take into account that these templates are inserted in the middle of the javascript code and may contain nothing but ranges
definition. For more examples on usingmomentlibrary refer tolibrary documentation.CreditsFilter widget uses a great JavaScript date range picker component -Date Range Pickerby Dan Grossman.
Package: django-daterangefilter-plus
Django admin date range filterApplication adds three Django admin list filters:DateRangeFilter,PastDateRangeFilterandFutureDateRangeFilter. These filters let user filter models by date range.PastDateRangeFilterandFutureDateRangeFilteradd quick selection of predefined date ranges. Filters can be applied to any model date fields. Application supports default Django admin theme andSuit theme.RequirementsPython 2.7+ or Python 3.3+Django 1.9+InstallationInstalldjango-daterangefilterusing pip:pipinstalldjango-daterangefilterAdddaterangefiltertoINSTALLED_APPS. Example:INSTALLED_APPS=(...'daterangefilter',...)Application uses static files so do not forget to issuecollectstaticmanagement command in production environment.Example usagein admin.py:fromdjango.contribimportadminfromdaterangefilter.filtersimportPastDateRangeFilter,FutureDateRangeFilter@admin.register(Post)classPostAdmin(admin.ModelAdmin):list_filter=[('created_at',PastDateRangeFilter),('publish_at',FutureDateRangeFilter)]Advanced usagePredefined ranges can be completely redefined by overriding_past_ranges.htmland_future_ranges.htmltemplates.
Take into account that these templates are inserted in the middle of the javascript code and may contain nothing but ranges
definition. For more examples on usingmomentlibrary refer tolibrary documentation.CreditsFilter widget uses a great JavaScript date range picker component -Date Range Pickerby Dan Grossman.
Package: django-daterange-filterspec
Django DateRange FilterspecAdds a form with AdminDateWidgets that can be used to select a range of
dates for filtering the list of records displayed in an admin Changelist.TheFrom dateselects records with a date equal or greater than the
specified date. TheTo dateselects record up to, but not including
the specified date. Either field is optional. If you only enter a date
in theFrom datefield then all records from that date onwards will be
displayed. Similarly if you only enter a date in theTo datefield then
only records before that date will be displayed.Quick startInstall the package from PyPI:pipinstalldjango-daterange-filterspecThe package includes a template, which loads Django's calendar widget
and date shortcuts. Add the package to the INSTALLED_APPS setting so the
template loader can find it:INSTALLED_APPS=(..."daterange.apps.DateRangeFilterConfig",...)In your ModelAdmin, set the template used for the changelist to the one
provided by the package. Then, for each field you want to filter on
create a tuple with the name of the field and theDateRangeFilterfilter class:fromdjango.contribimportadminfromdaterange.filtersimportDateRangeFilterfrom.modelsimportArticle@admin.register(Article)classArticleAdmin(admin.ModelAdmin):list_display=["title","slug","published"]list_filter=[("published",DateRangeFilter)]ordering=["-created"]change_list_template="admin/daterange/change_list.html"If you're already using a customised changelist template, you can add the necessary
css and javascript files to the Media class for the ModelAdmin:@admin.register(Article)classArticleAdmin(admin.ModelAdmin):...classMedia:css={"all":("admin/css/forms.css","css/admin/daterange.css")}js=("admin/js/calendar.js","js/admin/DateRangeShortcuts.js")Now, go forth and filter!DemoIf you check out the project from the repository there is a fully functioning
Django site that you can use to see the filter in action.gitclonegit@github.com:StuartMacKay/django-daterange-filterspec.gitcddjango-daterange-filterspecCreate the virtual environment:python-mvenvvenvsourcevenv/bin/activate

pipinstall--upgradepipsetuptoolswheel
pipinstallpip-tools
pip-syncrequirements/dev.txtRun the demo:pythonmanage.pymigrate
pythonmanage.pycreatesuperuser
pythonmanage.pyrunserverNow log into the Django Admin. In the Demo section, add some Articles
for different dates and filter away.
Package: django-datetime-helpers
django-datetime-helpersFrequently used functions and constants about datetime in Django projectsInstallingpip install django-datetime-helpersExamples# Quering all Users who join today
users = User.objects.filter(
    created_at__date=today()
)

# Quering all Users who join in last 12 hours
users = User.objects.filter(
    created_at__gte=secons_ago(12 * HOUR)
)

# Declaring constanst
USER_SOMETHING_TIMEOUT = 5 * MINUTE

# Waiting for something
time.sleep(MINUTE)For more examples seesource code.
Package: django-datetime-utc
django-datetime-utc providesDateTimeUTCField, a naive datetime model field. In PostgreSQL this translates to the fieldtimestamp without time zone. All timestamps are saved in UTC.Why use this?The problem with using Django’sDateTimeFieldis unless the default timezone on your (PostgreSQL) database server is set to UTC it doesn’t matter which TZ settings you select in Django, PostgreSQL will save all timestamps in local time with an offset.FeaturesSupports the defaultDateTimeFieldoptions such asauto_now_addandauto_nowSaves all timestamps in UTCValues automatically converted to local time (specified byTIME_ZONEin your projectsettings.py) in forms and templatesInstallFrom PyPi:$pipinstalldjango-datetime-utcInsettings.pyadddatetimeutcto the list of installed apps, set your local time zone and ensure time zone support is enabled:TIME_ZONE = 'Europe/London'
USE_TZ = True
INSTALLED_APPS = (
    #...
    'datetimeutc',
)UsageInmodels.py:fromdjango.dbimportmodelsfromdatetimeutc.fieldsimportDateTimeUTCFieldclassJourney(models.Model):name=models.CharField(max_length=100)departure_time=DateTimeUTCField(null=True)arrival_time=DateTimeUTCField(null=True)record_created=DateTimeUTCField(auto_now_add=True)NotesIf your code creates datetime objects, they should always be TZ aware so they are automatically converted correctly to UTC (if necessary) before being saved to the database.Using theJourneymodel above as an example, to setdeparture_timecorrectly you would:importdatetimefromdateutilimporttzdeparture_time=datetime.datetime.utcnow().replace(tzinfo=tz.gettz('UTC'))# or user defined (naive) datetime objectsdeparture_time=user_datetime.replace(tz.gettz(settings.TIME_ZONE))Journey.objects.create(name='Flight to LA',departure_time=departure_time)
Package: django-datetimezone-field
Here ishow it looks like.Written on top ofdjango-timezone-field.A Django app providing database and form fields for split datetime/time and pytz timezone objects.UseSplitDateTimeTimeZoneFieldin place offorms.DateTimeField.UseSplitTimeTimeZoneFieldin place offorms.TimeField.The settingUSE_TZ_FIELDS = Truewill convert alladmin.ModelAdminto useSplitDateTimeTimeZoneFieldformodels.DateTimeFieldandSplitTimeTimeZoneFieldformodels.TimeField.RequiresUSE_TZ = Trueinsettings.pyNoteIf using a database that does not support timezone-aware times then the initial values of model forms will always be in the UTC timezone.Form Fieldimportpytzfromdjangoimporthttpfromdjangoimportformsfromdjango.utilsimporttimezonefromdjango.forms.utilimportto_current_timezonefromdjango.confimportsettingsfromdatetimezone_fieldimportSplitDateTimeTimeZoneField,\SplitTimeTimeZoneFielddefindex(request):classMyForm(forms.Form):a_datetime=SplitDateTimeTimeZoneField()a_time=SplitTimeTimeZoneField()tz=pytz.timezone("Australia/Sydney")timezone.activate(tz)now=to_current_timezone(timezone.now()).replace(tzinfo=tz)my_form=MyForm(initial={'a_datetime':now,'a_time':now.time().replace(tzinfo=now.tzinfo)})returnhttp.HttpResponse(my_form.as_p())InstallationFrompypiusingpip:pipinstalldjango-datetimezone-fieldAddtimezone_fieldanddatetimezone_fieldto yoursettings.INSTALLED_APPSINSTALLED_APPS=(...timezone_field,datetimezone_field,...)Running sample projectcd test/sample_projectvirtualenv sample-envsource sample-env/bin/activatepip install -r requirements.txtpython manage.py syncdbpython manage.py runserverTODOUnit testsFound a Bug?To file a bug or submit a patch, please head over todjango-datetimezone-field on github.CreditsBuilt on top ofMike Fogel’s django-timezone-field.
Package: django-datum
django-datumDatums are a generic way to track notes that your system should keep track of.
Think of it as internal logging for your application.InstallationTo install the latest release, type:pip install django-datumTo install the latest code directly from source, type:pip install git+git://github.com/ambitioninc/django-datum.gitDocumentationFull documentation is available athttp://django-datum.readthedocs.orgLicenseMIT License (see LICENSE)
Package: django-daylessdate
Provides a Django model and form fields for dates that do not include days.PrerequisitesDjango 3.0+Python 3.6+Installationpip install django-daylessdateUsageThe package provide fieldsDaylessDateField.Adddjangodaylessdateto INSTALLED_APPS:INSTALLED_APPS = (
    ...
    'djangodaylessdate',
    ...
)DaylessDateFieldDaylessDateFieldstores a date without a day: January 2021, for example.Its default widget consists of one dropdowns and one input, one for a month and one for the year.Here’s an examplemodels.pythat declares a model with a required dayless date:from django.db import models
from djangodaylessdate.models import DaylessDateField

class MyModel(models.Model):
    month = DaylessDateField()The values ofDaylessDateFieldon the model instances can be accessed like so:>>> a = MyModel.objects.get(id=1)
>>> a
<MyModel: August 2021>
>>> a.month.month
8
>>> a.month.year
2021
>>> print a.month
August 2021They can also be compared or sorted as would be expected, for example:>>> m = MyModel.objects.all()
>>> m
[<MyModel: August 2021>, <MyModel: January 2021>]
>>> m[0].month > m[1].month
True
>>> m.order_by('month')
[<MyModel: January 2021>, <MyModel: August 2021>]In admin.py:from djangodaylessdate.filters import DaylessDateFilter

@admin.register(MyModel)
class MyModelAdmin(admin.ModelAdmin):
    list_filter = [('month', DaylessDateFilter)]
Package: django-dbaccounting
django_dbaccountingA Python based accounting core built with DjangoDB AccountingDB Accounting is a Django app that provides a core for accounting and account management.
Although developed primarily for accounting purposes, the flexible nature of DB Accounting,
allows it to be configured for anything that represents the need for categories, accounts, and transactions.Detailed documentation is in the "docs" directory.Quick startIf you are only looking to install the python package, use:pip install db-accountingdownload the .tar file from Githubinstall it from DjangoPackages.orgTo configure:Add "dbaccounting" to your INSTALLED_APPS setting like this::INSTALLED_APPS  [
...
'dbaccounting',
]Include the dbaccounting URLconf in your project urls.py like this::path('fin/',include('dbaccounting.urls')),Runpython manage.py migrateto create the dbaccounting models.Start the development server and visithttp://127.0.0.1:8000/adminto create Account Types and Accounts (you'll need the Admin app enabled).Visithttp://127.0.0.1:8000/fin/to manage your accounts.NotesThis is the first version so far, and some of the side links are not properly configured yet
(e.g. Balance Sheet rendering, etc). The application thus far provides core functionality for
transactions in general , which will be extended in future versions.Special thanks to those using this package and the feedback given. What started out as a side project
to help a few startups has now increased to include the open-source community. The package is coupled with
over 100 tests just to test the core functionality itself, and I have done my best to optimize for performance
and memory.If you liked this package, leave a star, and feel free to join my mailing list on robmel.com, where I occasionally
send out insights and goodies from tech, finance, AI and link them to the individual level.Best,
Robert M.Reach me on instagram: @officialrobmel or @quantrobbieSee my Github: @robml
Package: django-dbarray
Django model fields that store lists of values, implemented using the PostgreSQLARRAYtype.RequirementsPostgreSQLpsycopg2Django >= 1.2The ARRAY db type is PostgreSQL specific, so these model fields currently
work only on PostgreSQL with psycopg2.  AFieldErrorwill be raised if the
field is used with another database.This package has been tested with Django versions 1.2 through 1.6, inclusive.FieldsThe field types defined in thedbarraymodule are listed in the table below,
along with each field’s parent class (fromdjango.db.models), and the data
type of the postgresql column it will create.Each field takes the same arguments as its parent class.Field TypeParent ClassPostgresql TypeIntegerArrayFieldIntegerFieldinteger[]FloatArrayFieldFloatFielddouble precision[]TextArrayFieldTextFieldtext[]CharArrayFieldCharFieldcharacter varying[]DateArrayFieldDateFielddate[]Custom FieldsTo define a new array field for a base field typeFooField:import dbarray

class FooArrayField(dbarray.ArrayFieldBase, FooField):
    __metaclass__ = dbarray.ArrayFieldMetaclassThis may or may not work depending on a few factors.  You might, for example, need
to override the db_type method to make it put the[]in the right spot in the column
type used in generated SQL.Another issue that may arise when performing lookups with array fields
is that PostgreSQL may get the query parameter as a data type
that isn’t compatible with the type of the db column (for example text[]
instead of varchar[]).  Then you will get an error like the following:DatabaseError: operator does not exist: character varying[] = text[]
LINE 1: ... FROM "dbarray_chars" WHERE "dbarray_chars"."arr" = ARRAY['A...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.You can rectify this by settingcast_lookups = Trueon yourArrayFieldBasesubclass, which instructs it to add an explicit type cast
to the SQL query.Look in the source code for more examples of how to handle issues with new
ArrayField types.Version HistoryVersion 0.2Released:October 17, 2013The fields raise a FieldError exception if used on a database other than
PostgreSQL.  (This was the original behavior)Version 0.1Released:October 16, 2013Added tests and fixes for lookups and DateArrayField.Version 0.0.1Released:January 10, 2011Initial release
Package: django-dbase-storage
# Database storage for DjangoThis package implements the Django Storage API to store any file in any database supported by Django. In many cases it is a bad idea to store files in database because performance can degrade rapidly.## Requirements* Python 2.7, 3+* Django 1.7+## Installation1. Install using pip:```bashpip install django-dbase-storage```2. Add to INSTALLED_APPS:```pythonINSTALLED_APPS = (...'dbfile',)```3. Run migrations to create table to store files```python manage.py migrate dbfile```Now you can set default storage for the whole project in settings:```pythonDEFAULT_FILE_STORAGE = 'dbfile.storage.DatabaseStorage'```or specify it for certain fields of your models:```pythonclass UserFiles(models.Model):file = FileField(storage=DatabaseStorage())```##Known issuesDatabaseStorage fails to store file if debug-toolbar is enabled. Debug-toolbar converts binary to UTF-8 somewhere
Package: django-dbbackup-admin
django-dbbackup-adminget backup from database through admin panelThis is a simple and useful method to get backup from database through admin panel1. install packagepip install django-dbbackup-admin2. add this packages in INSTALLED_APPS :INSTALLED_APPS = [
    # ...
    'dbbackup',
    'solo',
    'dbbackup_admin'
    # ...
]3.read documents of django-dbbackup library from this link :https://django-dbbackup.readthedocs.io/en/master/4. set your desired config like this:DBBACKUP_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

DBBACKUP_STORAGE_OPTIONS = {
    'access_key': config("S3_ACCESS_KEY"),
    'secret_key':config("S3_SECRET_KEY"),
    'bucket_name': config("S3_BUCKET_NAME"),
    'default_acl': config("S3_DEFAULT_ACL"),
    'location':config("S3_BACKUP_FOLDER_NAME")
}Note: If you use s3 storage you should install boto3 package.5. create and migrate migrations in BASE_DIR:python manage.py migrate dbbackup_adminwhen you pass this missions toy will see this in your admin panel:when you click on save button backup will be saved on your desired bucket or directory.Thanks for attention
Package: django-dbbackup-ui
# Django Database Backup UIDjango Database Backup UI is an extension of Django Database Backup (django-dbbackup: https://github.com/django-dbbackup/django-dbbackup) that allows you to backup database and media files via Django Admin interface. An additional dbbackup_ui.wagtail module provides support for Wagtail Admin.![demo](http://g.recordit.co/WP3nIX330M.gif)## Supported versions* Django: 1.11* Wagtail: 1.10* Python: 3.4+## InstallationInstall using PIP:`pip install django-dbbackup-ui`### Regular Django Admin:1. Add **dbbackup_ui** to INSTALLED_APPS:`INSTALLED_APPS += ['dbbackup_ui']`2. Add url to your main **urls.py** just above root admin url:```urlpatterns = [url(r'^admin/backups/', include('dbbackup_ui.urls')),url(r'^admin/', include(admin.site.urls)),]```3. Granted you're logged in as a Superuser you should now be able to access the backup page via url:_http://example.com/admin/backups/backup-database-and-media/_### Wagtail Admin:1. If you use dbbackup_ui with Wagtail, add **dbbackup_ui.wagtail** to INSTALLED_APPS:`INSTALLED_APPS += ['dbbackup_ui.wagtail']`2. Granted you're logged in as a Superuser you should now be able to access the backup page via url:_http://example.com/admin/backup-database-and-media/_Additionally, you should see a new menu item labeled Backup DB & Media in the navigation sidebar on the left.## UsageWhen on **Backup Database and Media** page, you should see two buttons: "Download database backup" and "Download media backup". By clicking on one of these buttons, a backup process starts and eventually, a backup file gets downloaded by your browser. Please be advised that clicking on the buttons doesn't create a backup on the server. If you need to create server stored backups, you should use command-line and commands provided by django-dbbackup module.This extension allows to make a quick backup and get it downloaded to your computer. Don't use this tool if you have large database dumps and / or lots of media. This tool is suitable for small installations.Also, remember about possible security risks due to exposing backup capabilities to web interfaces. Use at your own risk.# History0.1.5 (2017-06-02)------------------* First release on PyPI.
Package: django-dbcache-fields
Version:0.9.3Docs:https://django-dbcache-fields.readthedocs.io/Download:https://pypi.python.org/pypi/django_dbcache_fieldsSource:https://github.com/maykinmedia/django-dbcache-fieldsKeywords:django, database, cache, methods, decoratorAboutThis library provides a decoratordbcachethat caches the result of your
DjangoModelmethods in your database.It adds a regularFieldon yourModelfor each method that you
decorate. This means you can use all ORM-functions like aggregation and
migrations. You can use existing fields or letdbcachecreate the field
for you.You can also invalidate the cached value by creating a _dirty_ function or by
indicating which other models affect the this cached value. By default, the
cached value is only updated when the model is saved.InstallationYou can installdjango_dbcache_fieldseither via the Python Package Index
(PyPI) or from source.To install usingpip:$pipinstall-Udjango_dbcache_fieldsUsageTo use this with your project you need to follow these steps:Install the django_dbcache_fields library:$pipinstalldjango_dbcache_fieldsAdddjango_dbcache_fieldstoINSTALLED_APPSin your Django
project’ssettings.py:INSTALLED_APPS=(# ...,'django_dbcache_fields',)Note that there is no dash in the module name, only underscores.All done. You can now decorate methods in yourModelwith@dbcache.ExampleSimple example to show whatdbcachedoes:fromdjango.dbimportmodelsfromdjango_dbcache_fields.decoratorsimportdbcacheclassIngredient(models.Model):name=models.CharField(max_length=100)price=models.DecimalField(max_digits=4,decimal_places=2)classPizza(models.Model):name=models.CharField(max_length=100)ingredients=models.ManyToManyField(Ingredient)@dbcache(models.DecimalField(max_digits=6,decimal_places=2,blank=True,null=True),invalidated_by=['myapp.Ingredient'])defget_price(self):returnself.ingredients.aggregate(total=Sum('price'))['total']orDecimal()Every call toget_pricewould normally perform a database query to
calculate the total price of all ingredients. However, thedbcachedecorator caused a new field to be added to the model: ADecimalFieldthat
can store the resulting value of theget_pricefunction, so it doesn’t
need to perform the same query over and over again.
Package: django-db-call
Copyright (c) 2014, Friedrich Paetzke (f.paetzke@gmail.com)
All rights reserved.Django-db-call creates a database configuration for a django project from command line input.It supports MySQL and PostgreSQL⁽¹⁾ right now.It comes with two functions:from_call()from_calls()You can installdjango-db-callviapip.$pipinstalldjango-db-callAn usage example:fromdjango_db_callimportfrom_callDATABASES=from_call('mysql -h localhost -u root -p my_sweet_secret -D my_db')That will become:DATABASES={'default':{'ENGINE':'django.db.backends.mysql','PORT':'','PASSWORD':'my_sweet_secret','HOST':'localhost','NAME':'my_db','USER':'root'}}You can change the connection name by passing a name for it:DATABASES=from_call('mysql',connection='not_default')And that is equivalent to:DATABASES={'not_default':{'ENGINE':'django.db.backends.mysql','HOST':'','NAME':'','PASSWORD':'','PORT':'','USER':''}}You can also pass additional arguments to be used inOPTIONS.DATABASES=from_call('mysql',autocommit=True)And that will give you:DATABASES={'default':{'ENGINE':'django.db.backends.mysql','NAME':'','USER':'','PASSWORD':'','HOST':'','PORT':'','OPTIONS':{'autocommit':True,},}}For creating multiple databases connections you can usefrom_calls().fromdjango_db_callimportfrom_callsDATABASES=from_calls([['mysql -h localhost -u root -p my_sweet_secret -D my_db'],['mysql -h localhost -u root -p my_sweet_secret -D archive',{'connection':'archive'}],])And that will result in:DATABASES={'default':{'PASSWORD':'my_sweet_secret','ENGINE':'django.db.backends.mysql','PORT':'','USER':'root','HOST':'localhost','NAME':'my_db'},'archive':{'PASSWORD':'my_sweet_secret','ENGINE':'django.db.backends.mysql','PORT':'','USER':'root','HOST':'localhost','NAME':'archive'}}⁽¹⁾ It seems it is not possible to pass the password to use a specific database onpsql. You have pass it explicitly.DATABASES=from_call('psql',password='my_sweet_secret')