Saravanan666/pypi-org huggingface dataset:
Package: django-time-block
django-time-blockan django application to save the timeline information of an object.Tutorialfromdjango_time_block.utilsimportadd_time_blockdefformat_datetime(date_str:str)->datetime.datetime:"""formate datetime string format"""returndatetime.datetime.strptime(date_str,"%Y-%m-%d%H:%M:%S",).astimezone(timezone.get_current_timezone(),)# record alice's work time according to her clock in recordobject_id="work_time_user_alice"add_time_block(# a timeblock record will be createdobject_id=object_id,start_datetime=format_datetime("2023-09-01 00:00:00"),end_datetime=format_datetime("2023-09-05 00:00:00"),)all_include(# alice didn't work from 2023-09-05 00:00 to 2023-09-06 00:00object_id,format_datetime("2023-09-02 00:00:00"),format_datetime("2023-09-06 00:00:00"),)# FalseTimeBlock.objects.filter(object_id=object_id).count()# 1add_time_block(# the second record will merged int the first oneobject_id=object_id,start_datetime=format_datetime("2023-09-01 00:00:00"),end_datetime=format_datetime("2023-09-05 00:00:00"),)TimeBlock.objects.filter(object_id=object_id).count()# 1all_include(object_id,format_datetime("2023-09-02 00:00:00"),format_datetime("2023-09-06 00:00:00"),)# TrueFor example:
You have to handle a lot of data from 2000-01-01 to 2023-11-11.First day, you may handle the data from 2023-10-01 to 2023-11-11Next day, you may have handled the data from 2023-09-01 to 2023-09-07:
the results look like this:you will record:2023-09-01~2023-09-07, 2023-10-01~2023-11-11the third day, you handled the data from 2023-09-06 to 2023-10-02
then, the records will merge into one:this two records will be merged:2023-09-01 ~ 2023-11-11APIadd_time_blockall_includecheck if a duration is all includedfind_min_unincludefind the earliest datetime that was not includedfind_max_unincludefind the latest datetime that was not includedfind_uninclude_blocksfind all the uninclude durationsTable of ContentsInstallationLicenseInstallationpip install django-time-blockLicensedjango-time-blockis distributed under the terms of theMITlicense.
Package: django-timecode
# django-timecodeA python class to store and manipulate timecodes with accompanying Django field.## ExamplesTimecodes can be created using a string representation>>> from timecode import Timecode
>>> start = Timecode('09:59:50:00', fps=25)
>>> end = Timecode('10:06:05:12', fps=25)They will print themselves>>> start
Timecode('09:59:50:00', fps=25)
>>> str(start)
'09:59:50:00'They can add and subtract>>> delta = end - start
>>> delta
Timecode('00:06:15:12', fps=25)Or you can get at the exact frames using thetotal_framesattribute>>> delta.total_frames
9387## In a Django model###models.pyfrom timecode.fields import TimecodeField
from django.db import modelsclass TestModel(models.Model):timecode = TimecodeField()You can then store the timecode objects in the database.
Package: django-timedelta
Installation$[sudo]pipinstalldjango-timedeltasettings.pyINSTALLED_APPS+=['django_timedelta']Examples{% load timedelta %}

{% if started_at and completed_at %}
    {% timedelta completed_at started_at %}
    {% timedelta completed_at started_at 3 %}
{% endif %}0:00:42.123456{% timedelta completed_at started_at 3 %}0:00:42.123readme42.com
Package: django-timelimit
Django-timelimit allows you to wrap sections of Django templates with a
timeout to enforce an upper bound on render time. When the templates exceeds
this time, an alternative fragment is rendered instead:{% load timelimit %}

{% timelimit 0.05 %}
  {# perform a potentially very slow operation #}
  <p>No timeout occurred</p>
  {% sleep 0.5 %}
{% else %}
  <p>Sorry, couldn't render the fragment in time.</p>
{% endtimelimit %}Installation$ pip install django-timelimitReentrantDjango-timelimit is fully reentrant, which means that you can have nested
timeouts:{% load timelimit %}

{% timelimit 0.10 %}
  {# perform a potentially very slow operation #}

    {% timelimit 0.05 %}
      {# perform another potentially slow operation #}
    {% else %}
      <p>Sorry, couldn't render the nested fragment in time.</p>
    {% endtimelimit %}

  <p>No timeout occurred</p>
{% else %}
  <p>Sorry, couldn't render the fragment in time.</p>
{% endtimelimit %}Nested timeouts allow a large outer timeout to contain smaller timeouts. If the
inner timeout is larger than the outer timeout, it is treated as a no-op.QuotasInterruptingcow quotas (introduced in interruptingcow 0.7) are supported too,
allowing you to share a single allocation of time between different timelimit
tags:{% load timelimit %}

{% for foo in bar %}
  {% timelimit quota_var %}
    ...
  {% else %}
    ...
  {% endtimelimit %}
{% endif %}This is useful in loops where you do not want the total render time to go up
with the number of iterations of the loop.CaveatsDjango-timelimit is based on interruptingcow and so it shares its limitations.
Interruptingcow usessignal(SIGALRM)to let the operating system interrupt
program execution, meaning:Python signal handlers only apply to the main thread, so you cannot use this
from other threads (this also means you cannot use this in a multithreaded
webserver, or even ones that use a background thread for request handling
(Gunicorn works great).You must not use this in a program that usesSIGALRMitself (this
includes certain profilers)
Package: django-timeline
There are two parts to using event streams.  The first is to declare an Event,
it looks like this:from django.contrib.auth.models import User

from timeline.base import EventType
from yourapp.library.models import Item


class AddedToLibrary(EventType):
    slug = "added-to-library"
    context_shape = {
        "user": User,
        "item": Item,
    }
    queryable_by = ["user", "item"]And then there is querying, all querying is encapsulated in thetimeline.base.Streamclass.  It is used like so:Stream(request.user)will return aStreamfor all of the events for therequest.user.pkUser.
It can take any number of positional arguments and it will combine their streams.It also takes a number of keyword arguments.event_typewhich will return
onlyEventsfor a given slug.limita number saying how manyEventsshould be included, defaults to 20.clustera boolean saying
whether the data returned should be clustered, if it is than it yields a list
ofEvents, rather than discreteEvents.
Package: django-timeline-logger
A reusable Django app to log actions and display them in a timelinePrerequisitesThis project usesdjango.db.models.JSONField, and as such, you need:at least Django 3.2+a database supportingdjango.db.models.JSONFieldA modern setuptools versionInstallationInstall from PyPI by runningpip install django-timeline-loggerAdd'timeline_logger'to yourINSTALLED_APPS.Run the migrations:python manage.py migrateUsage in templatesA custom template tag is provided to render the message of a log entry, for example:{% extends "timeline_logger/base.html" %}
{% load timeline %}

{% block timeline %}
    <ul class="timeline__list col__22--vw">
    {% for log in object_list %}
        <li class="timeline__entry">
            {% render_message log in_view=True %}
        </li>
    {% endfor %}
    </ul>
{% endblock timeline %}This way, you can pass extra context to the template used for the log object.DocumentationThe extended documentation is available onRead the Docs.
Package: django-time-logger
# django-time-logger[![Build Status](https://travis-ci.org/telminov/django-time-logger.svg?branch=master)](https://travis-ci.org/telminov/django-time-logger)[![Coverage Status](https://coveralls.io/repos/telminov/django-time-logger/badge.svg?branch=master)](https://coveralls.io/r/telminov/django-time-logger?branch=master)Installation python package:```$ pip install django-time-logger```Add middleware into settings.py:```MIDDLEWARE_CLASSES = (...'time_logger.middleware.view_logger.ViewTimeLogger',...)```Set threshold time value in seconds into settings.py for logging view```LOG_VIEW_TIME = 10```Optional can be set mongo database for logging```mongoengine.connect(...)mongoengine.register_connection('local', ...)...LOG_VIEW_TIME_DB_ALIAS = 'local'```Mysql configuration for slow queries logging. Block [mysqld] in my.cnf should contain next strings:```slow_query_log = 1long_query_time = 3log_output = TABLEexpire_logs_days = 1 - See more at: http://gurutek.biz/mysql-slow-query-logging-to-table/#sthash.FZAL94hW.dpuf```Set mysql configs without restart server:```set global log_slow_queries = 1;set global long_query_time = 3;set global log_output = 'TABLE';set global expire_logs_days = 1;set global log = 1; - See more at: http://gurutek.biz/mysql-slow-query-logging-to-table/#sthash.FZAL94hW.dpuf```
Package: django-time-out
A reusable Django application that allows you to put your Django site into maintenance mode.InstallationTo get the latest stable release from PyPi$pipinstalldjango-time-outTo get the latest commit from GitHub$pipinstall-egit+git://git.com:sparky300/django-time-out.git#egg=time_outAddtime_outto yourINSTALLED_APPSINSTALLED_APPS=(...,'time_out',)Add down_time middleware class to your settings.'time_out.middleware.DownTimeMiddleware',Don’t forget to migrate your database./manage.pymigratetime_outUsageThis application simply runs middleware that checks to see if the site is down for
maintenance based on scheduled maintenance dates/times.ContributeIf you want to contribute to this project, please perform the following steps# Fork this repository
# Clone your fork$mkvirtualenv-ppython2.7django-time-out$pythonsetup.pyinstall$pipinstall-rdev_requirements.txt$gitco-bfeature_branchmaster# Implement your feature and tests$gitadd.&&gitcommit$gitpush-uoriginfeature_branch# Send us a pull request for your feature branch
Package: djangoTimepicker
djangoTimepickerdjangoTimepicker：django 时间戳时间控件，可以在整数字段中使用该控件功能支持整数格式添加时间控件支持自定制时间格式以及时间控件语言显示类型安装Install> $ pip install djangoTimepickeradddjangoTimepickerto yourINSTALLED_APPSsetting使用appforms.py中导入DjangoTimePickerInput，在ModelForm中需要添加时间控件的字段中使用该组件# models.py
from django.db import modelsclass Person(models.Model):name = models.CharField(max_length=32, blank=False)
createdAt = models.BigIntegerField(verbose_name=’创建时间’, blank=True)# forms.py
from django import formsfrom . models import Personfrom djangoTimepicker import DjangoTimePickerInputclass PersonForm(forms.ModelForm):class Meta:model = Personfields = (‘__all__’)widgets = {
‘createdAt’: DjangoTimePickerInput(timeFormat=’YmdHis’, language=’zh’)
}appxadmin.py中导入PersonFormimport xadminimport .forms import PersonForm@xadmin.sites.register(User)class PersonModelAdmin(object):form = PersonForm支持的时间格式(timeFormat)：Y:年 m:月 d:日  H:时 i:分 s:秒支持的语言(language)：ar - Arabicaz - Azerbaijanian (Azeri)bg - Bulgarianbs - Bosanskica - Catalàch - Simplified Chinesecs - Češtinada - Danskde - Germanel - Ελληνικάen - Englishen-GB - English (British)es - Spanishet - “Eesti”eu - Euskarafa - Persianfi - Finnish (Suomi)fr - Frenchgl - Galegohe - Hebrew (עברית)hr - Hrvatskihu - Hungarianid - Indonesianit - Italianja - Japaneseko - Korean (한국어)kr - Koreanlt - Lithuanian (lietuvių)lv - Latvian (Latviešu)mk - Macedonian (Македонски)mn - Mongolian (Монгол)nl - Dutchno - Norwegianpl - Polishpt - Portuguesept-BR - Português(Brasil)ro - Romanianru - Russianse - Swedishsk - Slovenčinasl - Slovenščinasq - Albanian (Shqip)sr - Serbian Cyrillic (Српски)sr-YU - Serbian (Srpski)sv - Svenskath - Thaitr - Turkishuk - Ukrainianvi - Vietnamesezh - Simplified Chinese (简体中文)zh-TW - Traditional Chinese (繁體中文)Tips: 该项目引用 [datatimepicker](https://github.com/xdan/datetimepicker), [点击查看更多配置](https://xdsoft.net/jqplugins/datetimepicker/)实例展示- 时间格式：’YmdHis’: 年月日时分秒![image](https://github.com/DanielZhui/django-time-picker/blob/master/display/created.jpg)时间格式：’Y-m-d H-i-s’: 年-月-日 时-分-秒![image](https://github.com/DanielZhui/django-time-picker/blob/master/display/createds.jpg)
Package: django-times
Django TimesDjango Times es un modulo el cual busca mejorar y optimizar el trabajo al momento de pasar fechas y dias a los templates en django y asi mejorar el mantenimiento del codigo.Informacion GeneralEste proyecto proporciona una biblioteca que facilita el trabajo con fechas y horas en aplicaciones Django. Ofrece una serie de etiquetas y funciones personalizadas que permiten obtener y formatear la fecha y hora actual, asi como configurar la zona horaria y el idioma en algunos casos.ProyectoEste proyecto tiene como objetivo simplificar el manejo de fechas y horas en aplicaciones Django. Algunos de los aspectos clave del proyecto incluyen:Obtener la fecha y hora actual de acuerdo con la zona horaria configurada en las opciones de Django.Formatear la fecha y hora de diferentes maneras segun las necesidades del usuario.Personalizar la zona horaria y el idioma para adaptarse a requisitos especificos.Instrucciones de UsoInstalacionPara utilizar esta biblioteca en tu proyecto Django, sigue estos pasos:Crea un entorno virtual para tu proyecto (se recomienda, pero opcional).py-mvenvenv# Windowspython3-mvirtualenvenv# LinuxActiva el entorno virtual.\env\Scripts\activate# Windowssourceenv/bin/activate# LinuxInstala los django_timespip install django-timesINSTALLED_APPSINSTALLED_APPS=[...'django_times',...]Recoger archivos estaticospymanage.pycollectstatic# Windowspython3manage.pycollectstatic# LinuxUsoPara usar django times dentro de tus plantillas de django debes de cargar el tag, para ello usa:{% load django_times %}Y ya puedes usar los distintos tags que te ofrece django-times:ver mas...ContribucionÂ¡Gracias por considerar contribuir a este proyecto! Si deseas contribuir, sigue estos pasos:Crea un fork del repositorio en GitHub.Clona tu repositorio fork en tu entorno de desarrollo local.git clone https://github.com/TU_NOMBRE_DE_USUARIO/django-times.gitCrea tu entorno virtual, activalo e instala requirements-dev.txtCrea una rama para tu contribucion.git checkout -b mi-contribucionRealiza tus cambios y realiza confirmaciones significativas.Ejecutapre-commit run --all-files, si falla vuelve a ejecutarlo hasta que todo sea "Passed" de lo contrario soluciona los errores.Envia una solicitud de extraccion (pull request) a la rama principal del proyecto.Tu solicitud de extraccion sera revisada y, si es aceptada, se fusionara con el proyecto principal.Recuerda siempre editar el archivo CHANGELOG.md indicando que cambios realizastes, tambien se descriptivo en el mensaje de tu commit y  agrega tu nombre a CONTRIBUTORS siguiendo el orden alfabetico.
Package: django-timestampable-model
Django Timestampable model is a simple enhancement mixin that enables Django models to have acreated_atandupdated_atfield that is always updated.This has been done under many pluginsBUTthe main difference between this plugin and the
many others out there that do the same, is that Django Timestampable Models update
theupdated_atfield under any circumstance: fixture loading, bulk updates, etc. whereas traditional
Timestampable mixins only provide shorthand forauto_addandauto_add_nowshortcuts forDateTimeFields.It achieves this by using Django signals.Quick startAdd “django_timestampable” to yourINSTALLED_APPSsettings like this:INSTALLED_APPS=[...'django_timestampable',]AddTimestampableModelin yourModels like so:classStuff(TimestampableModel):some_attribute=CharField()...3. Runpython manage.py makemigrationsthenpython manage.py migrateto add the columns to your models
in your database.RequirementsNo dependencies.Tested onDjango1.9.9, 1.10.1 with Python 2.7, 3.4, 3.5
Package: django-timestamps
Django TimestampsAdds created_at, updated_at, and/or deleted_at (soft-delete) to django modelsUsagefrom django.db import models
from django_timestamps.softDeletion import SoftDeletionModel
from django_timestamps.timestamps import TimestampsModel

class Device(SoftDeletionModel, TimestampsModel):
    name = models.CharField(max_length=20)
    os = models.CharField(max_length=20)TimestampsModel adds created_at and updated_at fields to the model. This fields are updated automaticallySoftDeletionModel adds deleted_at (soft-delete)To soft-delete a model you must call delete() function:device = Device.objects.filter(id=1).first()
device.delete()To hard-delete a model you must call hard_delete() function:device = Device.objects.filter(id=1).first()
device.hard_delete()To restore a model you must call restore() function and use all_objects instead of objects:device = Device.all_objects.filter(id=1).first()
device.restore()To get all objects trasheddevices_trashed = Device.all_objects.all().dead()ModelViewSet for rest_framework:Adds urls for soft-deleted elements, returns deleted_at:#Example for devices:
#    (get)   /devices/trashed/       -> trashed elements, paginated
#    (get)   /devices/4/get-trashed/ -> get trashed element
#    (patch) /devices/4/restore/     -> restore trashed element

from django_timestamps.SoftDeleteViewSet import SoftDeleteViewSet

class DeviceViewSet(viewsets.ModelViewSet, SoftDeleteViewSet):
    queryset = Device.objects.all().order_by('id')
    serializer_class = DeviceSerializer
    querysetTrashed = Device.all_objects.all().dead().order_by('id')

    #add extra filters for queryset and querysetTrashed
    def full_queryset(self, queryset):

        user_id = self.request.query_params.get('user_id', None)
        if user_id:
            queryset = queryset.filter(user_id=user_id)

        return queryset
Package: django-timetable
django-timetable========================Required packages------------------* django-taggithttps://github.com/alex/django-taggit* django-colorfulhttps://github.com/charettes/django-colorfulInstallation------------1. Install django-timetable$ pip install django-timetable2. In settings.py file add the following to DJANGO_APPS:DJANGO_APPS = (...'taggit','timetable',)Change Log----------0.1.7:- Get update url from the model (get_absolute_update_url)- Search in admin via the name and now tags- Default admin sort order via the start_date_time0.1.6 - Removed the event all day event replaceing start and end time because it didn't handline timezone correctly.0.1.5 - Fixed syntax error in the model0.1.4:- Changed unicode name- Removed unused code0.1.3 - Fixed an issue with all day events0.1.2:- Made the Event name searchable on the admin page.- Updated the instructions.0.1.1 - Fixed packaging issue for PyPi0.1.0 - Base working version
Package: django-time-wizard
Date and time dependent content manipulation.Quick startInstall using pip:pip install django-time-wizardMake sure to follow the installation steps fordjango-polymorphicAdd to yourINSTALLED_APPS:'polymorphic',
'time_wizard',Include the time_wizard admin URLs in your project urls.py:path('admin/', include('time_wizard.urls')),Runpython manage.py migrateto create the time_wizard models.NoteUpgrading from version0.2.0to1.0.0will delete all the created  models
oftime_wizard!UsageYou can use theTimeWizardin different ways:use aForeignKey-relationuse oneTimeWizardModel-definition for as much models as you wantaffects your database as the relation needs a new model fieldexample:# models.py
from time_wizard.mixins import TimeWizardMixin
...
class MyModel(TimeWizardMixin, models.Model):
    ...use thePeriodModelInlinein theadmineach model of yours can have different time-settingsdoes not affect your database as it works with a generic relationshipexample:# models.py
from time_wizard.mixins import TimeWizardInlineMixin
...
class MyModel(TimeWizardInlineMixin, models.Model):
    ...

# admin.py
from time_wizard.admin import PeriodModelInline
from polymorphic.admin import PolymorphicInlineSupportMixin
...
class MyModelAdmin(PolymorphicInlineSupportMixin, admin.ModelAdmin):
    inlines = [PeriodModelInline]
    ...in both ways useis_publishedon your model to indicate if the content
is shown or not.create a customPeriodModelas a base for customAbsoluteRange- andHolidayRange-models. There are abstract base classes
defined inmodels/abstract.py. This means you could for example create
classes without a generic relation, asPeriodModelitself has.SettingsDjango-time-wizard uses the definedcountriesandprovinces/statesfromholidays. Definitions need to be compatible withholidays. You can also
define this yourself for your needs:TIME_WIZARD_COUNTRIES = ['US', 'UK', 'DE', ...]
TIME_WIZARD_COUNTRY_PROVINCES = {'US': ['AL', 'AK', ...], ...}Requirementsdjangodjango-polymorphicholidaysTestsSetup your test environment withvirtualenvand install the requirements
withpip install .. Also installtoxvia pip and simply runtox.Tests can also be run viadevtools/run-tests. This requires an environment
wheredockeranddocker-composeare installed.
Package: django-timezone-field-ng
A Django app providing database and form fields forpytztimezone objects.ExamplesDatabase Fieldimportpytzfromdjango.dbimportmodelsfromtimezone_fieldimportTimeZoneFieldclassMyModel(models.Model):timezone1=TimeZoneField(default='Europe/London')# defaults supportedtimezone2=TimeZoneField()timezone3=TimeZoneField()my_inst=MyModel(timezone1='America/Los_Angeles',# assignment of a stringtimezone2=pytz.timezone('Turkey'),# assignment of a pytz.DstTzInfotimezone3=pytz.UTC,# assignment of pytz.UTC singleton)my_inst.full_clean()# validates against pytz.common_timezonesmy_inst.save()# values stored in DB as stringstz=my_inst.timezone1# values retrieved as pytz objectsrepr(tz)# "<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>"Form Fieldfromdjangoimportformsfromtimezone_fieldimportTimeZoneFormFieldclassMyForm(forms.Form):timezone=TimeZoneFormField()my_form=MyForm({'timezone':'America/Los_Angeles',})my_form.full_clean()# validates against pytz.common_timezonestz=my_form.cleaned_data['timezone']# values retrieved as pytz objectsrepr(tz)# "<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>"InstallationFrompypiusingpip:pipinstalldjango-timezone-field-ngAddtimezone_fieldto yoursettings.INSTALLED_APPS:INSTALLED_APPS=(...'timezone_field',...)Changelog2.0 (2016-09-09)Fork the repository from mfogel and tag 2.0 release2.0rc1 (2016-01-31)Drop support for django 1.7, add support for django 1.9Drop support for python 3.2, 3.3, add support for python 3.5Remove tests from source distribution1.3 (2015-10-12)Drop support for django 1.6, add support for django 1.8Variousbug fixes1.2 (2015-02-05)For form field, changed default list of accepted timezones frompytz.all_timezonestopytz.common_timezones, to match DB field
behavior.1.1 (2014-10-05)Django 1.7 compatibilityAdded support for formatingchoiceskwarg as[[<str>, <str>], …],
in addition to previous format of[[<pytz.timezone>, <str>], …].Changed default list of accepted timezones frompytz.all_timezonestopytz.common_timezones. If you have timezones in your DB that are inpytz.all_timezonesbut not inpytz.common_timezones, this is a
backward-incompatible change. Old behavior can be restored by
specifyingchoices=[(tz, tz) for tz in pytz.all_timezones]in your
model definition.1.0 (2013-08-04)Initial release astimezone_field.Running the TestsInstalltox.From the repository root, runtoxPostgres will need to be running locally, and sqlite will need to be
installed in order for tox to do its job.Found a Bug?To file a bug or submit a patch, please head over todjango-timezone-field-ng on github.CreditsThis project is a fork of the work done byMike Fogel’s django-timezonesAnd was originally adapted fromBrian Rosner’s django-timezones. The full list of contributors is available ongithub.
Package: django-tiniest-cms
Django tiniest cms==================Installation------------#. The recommended way to install django-tiniest-cms package is with pip.$ pip install django-tiniest-cms#. Then add 'django-tiniest-cms' to `INSTALLED_APPS`.Usage-----Assuming this would be the frontpage template of a website :{% load tiniest_cms %}<html><head><title>{% content "website/frontpage/title" %}NO TITLE{% endcontent %}</title></head><body>{% content "website/frontpage/main_content"%}This is the website of ACME corporation{% endcontent %}</body></html>Then in the administration you can add the content snippet matching the namegiven to the `content` tags. The content will be rendered as markdown insteadof the default given to the `content` tags.