Saravanan666/pypi-org huggingface dataset:
Package: django-tracked-model
Simple django app for tracking db changes executed through orm. (Only
tested on python3 and django-1.8.1)UsageOnce installed (see ``Installation`` below), every change to tracked
model will be recorded whenever ``save`` or ``delete`` is called.To include usefull information about circumstances of the changes usemodel.save(request=request)ormodel.save(track_token=token)Same goes formodel.delete(), whererequestis just djangoHttpRequestinstance, andtokenis result oftracked_model.control.create_track_token(request)call.This will store djagno user making changes along with ip, host, user
agent, request path, request method, referer and request timestamp.To access model’s history, call it’stracked_model_historymethodmodel.tracked_model_history()Model instance can be created fromHistoryinstance by callingmaterializemodel = SomeModel.objects.create(attr='initial')
model.attr = 'change 1'
model.save()
model.attr = 'change 2'
model.save()

model_initial_state = model.tracked_history().first().materialize()Installation$pipinstalldjango-tracked-modelAddtracked_modeltoINSTALLED_APPSinsettings.Synch db$pythonmanage.pysyncdbMark model as trackablefrom django.db import models
from tracked_model.control import TrackedModelMixin as Tracked

class MyModel(Tracked, models.Model):
    spam = models.IntegerField()
    egg = models.TextField()Tests & modsIf for some weird reason you want to hack around, clone repo and install
stuff from dev-reqs.txt$pipinstall-rdev-reqs.txtThere is a Makefile with some handy shortcuts e.g.$maketest$makeqaPoke around Makefile for details
Package: django-tracking-analyzer
User actions tracking and analytics for Django sitesRequirementsDjango 2.1 or later.Django Countries5.5 or later.Django IPWare2.1.0 or later.Django User Agents0.4.0 or later.GeoIP22.9.0 or later.MaxMind GeoLite2 country datasets.InstallationInstall Django Tracking Analyzer from PyPI by usingpip:pip install django-tracking-analyzerAdd'django_user_agents'and'tracking_analyzer'entries to DjangoINSTALLED_APPSsetting.Run the migrations to load theTrackermodel in your database:python manage.py migrate tracking_analyzerInstall the MaxMind® GeoIP2 datasets. You can do this in two ways:4.1. By running the provided management command for this:python manage.py install_geoip_dataset4.2. Or manually, by following the instructions inGeoIP2 Django documentation.After following those steps, you should be ready to go.Explanation - QuickstartDjango Tracking Analyzer is a Django pluggable application which helps you
providing usage statistics and visitors data for your Django sites.DTA does this by recording requests data in those places you want to by savingTracker’s. ATrackeris a Django database model which holds all the
data related to a request, including geolocation via IP address and device or
browser specifications.When some data is collected, the Django admin interface forTrackermodel
implements some interactive widgets to help you visualize better the data.Now let’s see how can you start collecting users data. Imagine the most basic
example: you have a web blog and you want to check the visits to your posts,
having a resume of who accessed the posts, when and from where. In such a Django
site, you might have a viewPostDetailView, where a blog post will be served
by passing its slug in the URL. Something like this:classPostDetailView(DetailView):model=PostOkay, so you can track the users who access blog posts by their instances with
DTA, just like this:classPostDetailView(DetailView):model=Postdefget_object(self,queryset=None):# Retrieve the blog post just using `get_object` functionality.obj=super(PostDetailView,self).get_object(queryset)# Track the users access to the blog by post!Tracker.objects.create_from_request(self.request,obj)returnobjAnd you are now on your way to collect users data! Now give it a time (or better
access the resource yourself several times) and go check your Django admin in
the “Django Tracking Analyzer” - “Trackers” section. Enjoy!DocumentationFor extensive documentation and usage explanations, you can checkRead the Docs.AcknowledgementsDjango Tracking Analyzer makes use of this technologies and apps, without which it wouldn’t be possible:Django Countries, by Chris Beaven.Django IPWare, by Val Neekman.Django User Agents, by Selwin Ong.Datamaps, by Marc DiMarco.TopoJSON, by Mike Bostock.D3 bar chart w/tooltips, original code by Justin Palmer.D3 area chart, by Mike Bostock.Of course, theD3.js library.AndMaxMind, the company behind all the geographical datasets that made them publicly available.
Package: django-tracking-fields
Tracking FieldsA Django app allowing the tracking of objects field in the admin site.RequirementsDjango 2.2: See older versions for earlier version of Django.django-cuser: Only if you want to track which user made the modifications.Quick startAdd “tracking_fields” to your INSTALLED_APPS settings.Add thetracking_fields.decorators.trackdecorator to your models with the fields you want to track as parameters:@track('test', 'm2m')
class MyModel(models.Model):
    test = models.BooleanField('Test', default=True)
    m2m = models.ManyToManyField(SubModelTest, null=True)Your objects are now tracked. See the admin site for the tracking information.If you want to track who does the changes, please install thedjango-cuserapp.You can also track fields of related objects:class MyModel(models.Model):
    test = models.BooleanField('Test', default=True)

@track('related__test')
class MyOtherModel(models.Model):
    related = models.ForeignKey(MyModel)You can run the tests withtox(make sure to havedjango-cuserinstalled).Upgrades from 0.1 or 1.0.1The change to UUID is a mess to do in a migration. The migrations have thus been squashed. You can either alter your fields by hand and do a fake migration afterward or remove your tracking fields tables and run migrations again:./manage.py migrate --fake tracking_fields zero
./manage.py migrate tracking_fieldsFAQWhy does my relationship change create two events ?Please seehttps://docs.djangoproject.com/en/1.7/ref/models/relations/#direct-assignmentAUTHORSYann FOUILLAT (alias Gagaro) <yann.fouillat@makina-corpus.com>LICENSEGPLv3+Changelog1.4.0 (2023-06-15)Drop Django < 3.2 supportAdd Django 4.2 supportDo not store M2M managers on the instance as original values.Fix TrackerEventUserFilter performance.1.3.7 (2022-04-07)Do not tracked deferred related fields.1.3.6 (2022-03-16)Fix error on admin related to filtering content from deleted userFix deprecation warnings for Django 5.0.Django 3.2 and 4.0 compatibility1.3.5 (2022-03-09)Increase max_length of TrackedFieldModification.field from 40 to 2501.3.4 (2021-11-24)Bulk create TrackedFieldModification1.3.3 (2021-10-25)Fix tracking of models with uuid ids1.3.2 (2021-09-01)Fix related event when there is no backward relation.1.3.1 (2021-02-19)Addedget_object_model_verbose_name.1.3.0 (2021-02-19)Addedget_object_modelonTrackingEventto be able to get model class in templates.Fix deprecation warnings for Django 4.0.Drop support for Django 2.0 and 2.1.1.2.1 (2020-10-20)Deferred fields are not tracked to avoid additional requests.1.2.0 (2020-05-07)fix ‘str’ object has no attribute ‘name’ #6Django 3.0 compatibilityDrop support for Django 1.111.1.2 (2019-09-11)added serialization for xworkflow StateWrapper1.1.1 (2019-01-25)Optimize admin user lookup1.1.0 (2019-01-24)Compatibility with Django 1.11 to 2.1Compatibility droped for earlier versions1.0.6Fix unicode error in admin with Python 3.4 and django_cuser1.0.5Fix MANIFEST1.0.4Order TrackingEvent by -date1.0.3Fix MANIFEST1.0.2Include migrations in MANIFEST1.0.0Initial release
Package: django-tracking-model
Django Tracking Model / DTM 🏁Track changes made to your model's instance fields.Changes are cleared on save.This package works well withsignals.Mutable fields (e.g. JSONField) are not handled with deepcopy to keep it fast and simple.Meant to bemodel_utils's FieldTracker fast alternative.Available onPyPiInstallationpipinstalldjango-tracking-modelUsagefromdjango.dbimportmodelsfromtracking_modelimportTrackingModelMixin# order mattersclassExample(TrackingModelMixin,models.Model):text=models.TextField(null=True)myself=models.ForeignKey("self",null=True)array=models.ArrayField(TextField())In[1]:e=Example.objects.create(id=1,text="Sample Text")In[2]:e.tracker.changed,e.tracker.newly_createdOut[1]:({},True)In[3]:e.text="Different Text"In[4]:e.tracker.changedOut[2]:{"text":"Sample Text"}In[5]:e.save()In[6]:e.tracker.changed,e.tracker.newly_createdOut[3]:({},False)DTM will also detect changes made to ForeignKey/OneToOne fields.In[1]:Example.objects.create(myself=e)In[2]:e.myself=NoneIn[3]:e.tracker.changedOut[1]:{"myself_id":1}Because DTM does not handle mutable fields well, you handle them with copy/deepcopy.In[1]:e=Example.objects.create(array=["I","am","your"])In[2]:copied=copy(e.array)In[3]:copied.append("father")In[4]:e.array=copiedIn[5]:e.tracker.changedOut[1]:{"array":["I","am","your"]}In[6]:e.array=["Testing","is","the","future"]# in this case copy not neededDTM works best with *_save signals.defpre_save_example(instance,*args,**kwargs):# .create() does not populate .changed, we use newly_createdif"text"ininstance.tracker.changedorinstance.tracker.newly_created:ifinstance.textinstance.array=instance.text.split()pre_save.connect(pre_save_example,sender=Example)In[1]:e=Example.objects.create(text="I am your father")In[2]:e.refresh_from_db()# not neededIn[3]:e.arrayOut[1]:["I","am","your","father"]DTM handles deferred fields well.In[1]:e=Example.objects.only("array").first()In[2]:e.text="I am not your father"In[3]:e.tracker.changedOut[4]:{"text":DeferredAttribute}You can narrow choice of tracked fields. By default everything is tracked.classExample(models.Model):TRACKED_FIELDS=["first"]first=models.TextField()second=models.TextField()RequirementsPython >= 2.7, <= 3.11Django >= 1.11, <= 4.x.y
Package: django-trackings
dj-trackeris an app that tracks your queries to help detecting some possible performance optimisations listed inDatabase access optimization.FeaturesDetailed field usage of model instancesReport unused fields in a model instance and provides hints on when to use.deferand.onlyReport model instance attributes access and provides hints on when to use.valuesor.values_listReport cache hits and provides hints on when to useiteratorProvides hints on when to use.count,.contains,.existsDetect N+1 queriesDetect when a deferred field is loadedand many more insights into your queries with minimized overhead....DemoYou can trydj-trackerwith thebakerydemoon thedemo app.RequirementsPython:>=3.8Django:>=3.2django-filterGetting startedCheck out theinstallation stepsif you want to get started quickly or thetutorialto see a concrete example ofdj-trackerusage.DocumentationAll documentation is in the "docs" directory and online athttps://tijani-dia.github.io/dj-tracker/Development phase - Contributingdj-trackeris inalpha phase.You can help a lot byreporting bugsyou'll encounter. Feature requests, PRs or/and any feedback are also welcome.
Package: django-traffic-monitor
django-traffic-monitor is a Django application that eases to monitor server traffic.Quick startinstall with pip:pip install django-traffic-monitor django-crontabAdd “traffic_monitor” and “django-crontab” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'django_crontab',
    'traffic_monitor',
]Include the traffic_monitor URLconf in your project urls.py like this:urlpatterns += [
    url(r'^traffic/', include('traffic_monitor.urls')),
]Runpython manage.py migrateto create the traffic_monitor models.Find out your server’s network interface names using Linux command like ifconfig then set the name or names you wish to monitor in your project setting.:TRAFFIC_MONITOR_INTERFACE_NAMES = 'docker0,p2p1,eth0'Email setting required for Django. If sending email in your project is currently working, no need to change it.:EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com',
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your_email_id@gmail.com',
EMAIL_HOST_PASSWORD = 'your_password,
DEFAULT_FROM_EMAIL = 'your_email_id@gmail.com'(Optional) Set more configurations if you want to change from default.:# Permission to use: superuser, staff, member, all
TRAFFIC_MONITOR_PERMISSION = 'staff'

# Template for traffic monitoring page
TRAFFIC_MONITOR_TEMPLATE = 'traffic_monitor/show_traffic.html'

# Alarm will be sent if daily traffic exceeds
TRAFFIC_MONITOR_DAILY_ALARM_BYTES = 100 * 1024 * 1024 * 1024

# Alarm will be sent if monthly traffic exceeds
TRAFFIC_MONITOR_MONTHLY_ALARM_BYTES = 800 * 1024 * 1024 * 1024

# Alarm From Email
TRAFFIC_MONITOR_EMAIL_FROM = DEFAULT_FROM_EMAIL

# Alarm Email To (comma seperated list, can be more than one)
TRAFFIC_MONITOR_EMAIL_TO = [DEFAULT_FROM_EMAIL]

# Set False if you do not want to get email
TRAFFIC_MONITOR_ALARM_SEND_EMAIL = True

# Subject of email
TRAFFIC_MONITOR_ALARM_EMAIL_SUBJECT = 'Traffic limit alert'

# If traffic limit exceeds, the next alarm will be sent only if the traffic exceeds threshold from previous alarm
TRAFFIC_MONITOR_ALARM_BYTES_THRESHOLD = 10 * 1024 * 1024 * 1024Add cronjob in your settings.py to collect traffic automatically. (i.e. run every 5 minutes):CRONJOBS = [
    ('*/5 * * * *', 'traffic_monitor.tools.read_bytes', '>> /var/log/cronjob.log'),
]Run following command to add CRONJOBS to your system crontab:python manage.py crontab add
Package: django-trails
Django Trails is a Django app to provide audit logging capability to your
Django project.  Its main goals are to:Capture the current request and user with middleware.Capture database changes using signals.Log user and changes to the database.Log user and changes using Python logging library.Provide admin interface to view full audit trail for an object or user.Provide flexible template-based rendering of audit trails.While a number of parts are functional, it is still considered alpha quality
and does not yet support the following:Capturing changes made to many to many relationships.Tests to verify correct handling of proxy models or model inheritance.Tests to verify handling of custom model fields.Actually using the Python logging module.It is tested against Python 2.5, 2.6 and 2.7 and Django 1.3, 1.4 and 1.5
(except for Python 2.5 which isn’t supported by Django 1.5).
Package: django-traits
django-traitsDefine traits for Django models that works seamlessly both in-Python and using the ORM,
with coordinated tests.Installation$python3-mpipinstalldjango-traitsExampleclassRich(Trait["Person"]):q=models.Q(income__gt=1000)defcheck_instance(self,instance:Person)->bool:returninstance.income>1000classPerson(models.Model):is_rich=Rich()income=models.PositiveIntegerField()# Filter for rich people, this uses the ORM predicate as defined in q.rich_people=Person.is_rich.all()# Check if a person is rich, this uses the in-Python predicate as defined in check_instance().person=Person.objects.first()ifperson.is_rich:print("Money is not a problem")else:print("This person is not rich")The automated test factory makes it simple to write tests that guarantees that the
in-Python predicate stays in sync with its ORM counterpart.classTestPerson:test_is_rich=test_trait(((PersonFactory(),False),(PersonFactory(income=1000),False),(PersonFactory(income=1001),True),))The above example will generate tests that exercises the in-Python predicate on
instances ofPerson, as well as tests that tries to filter using the ORM predicate.
That means that if the implementations were to drift apart, for instance if the limit
was increased to2000incheck_instance()but not inq, the tests would fail.
Package: django-tranlation-sanitizer
Django Translation SanitizerDjango Translation Sanitizeris a simple Django app to sanitize the output ofmakemessagescommand by disabling fuzzy matching and sorting it's output.RationaleWhen one first create the*.pofiles with the originalmakemessagescommand everything seems
nice -- Django make clean file that one can easily edit via text editor.The actual "mess" comes after command has been running several times --
when Django tries to match previous translations of a changed original it often fails to do it correctly.The thing is that it failssilently. It takes enormous amounts of time to find and
fix the translation issues django had made.So instead of changing the previous translations this module simply adds the new ones,
leaving everything else untouched.How to use itInstall the package from PyPI like this:pipinstalldjango-translation-sanitizerAdd "translation_sanitizer" to your INSTALLED_APPS setting like thisINSTALLED_APPS=[...'translation_sanitizer',]That's it! Nowmakemessagescommand will produce clean, sorted and fuzzy-free output.
Package: django-transactional-cleanup
django-transactional-cleanup automatically deletes old file for FileField,ImageField and subclasses, and it also deletes files on models instance
deletion. This app is based on django-cleanup.Warning: It depends on django-transaction-hooks app and you need to
configure your database backend to use a django-transactional-hooks backend or
any that use the django-transactional-hooks backend mixin. See the
documentation here:https://django-transaction-hooks.readthedocs.org/.
Package: django-transactional-mail
Requirementsdjango>= 2.2Quick StartInstalldjango-transactional-mailpip install django-transactional-mailAddtransactional_mailtoINSTALLED_APPSin your project'ssettings.py.INSTALLED_APPS=(...'transactional_mail',...)Run migrations in your project to create the models for the CMS app../manage.py migrate transactional_mailDistributing and updateBuild an sdist to ensure that the templates are included:python -m build --sdistPublish to pypipython3 -m twine upload dist/*
Package: django-transaction-barrier
django_transaction_barrier provides a barrier-like abstraction for
transactions. A Django application developer can use a “transaction
barrier” to spawn a task within a transaction and guarantee that the
task blocks until it’s able to access the updates made in the
transaction. django_transaction_barrier is designed withCeleryin mind and provides a Celery
task base class. Using the base class it’s easy to write code that
atomically modifies the database and spawns a Celery task that executes
after the transaction commits.InstallationInstall from source or use pip:pipinstalldjango_transaction_barrierand add “django_transaction_barrier” to INSTALLED_APPS in
settings.py:INSTALLED_APPS=('django_transaction_barrier',...)Usagefromceleryimporttaskfromdjango.dbimporttransactionfromdjango_transaction_barrier.celeryimportTransactionBarrierTask@task(base=TransactionBarrierTask)defdo_something_task(model_id):value=Model.objects.get(id=model_id).value...@transaction.atomicdefkick_off_task(model,value):model.value=valuedo_something_task.apply_async_with_barrier(args=(model.id,))model.save()DetailsIf an application spawns an asynchronous TransactionBarrierTask the task
is guaranteed to execute eventually (assuming a durable task queue)
after the transaction commits. If the transaction aborts, the task
raises a TransactionAborted exception and does not execute. In
autocommit mode (i.e., “outside of a transaction”)
TransactionBarrierTasks behave like normal Celery tasks.If an application synchrnously executes a TransactionBarrierTask (e.g.,
with Celery eager mode) within a transaction, the task executes
immediately without waiting for the transaction to commit.Implementationdjango_transaction_barrier implements transaction barriers using row
insertion to signify a committed transaction and some DB-specifc logic
to detect an abort.Relatedhttps://pypi.python.org/pypi/django-transaction-signals-do-not-use/1.0https://django-transaction-hooks.readthedocs.org/en/latest/https://code.djangoproject.com/ticket/14051https://github.com/nickbruun/django_atomic_celerydjango_transaction_barrier provides diffferent semantics than related
projects. It guarantees TransactionBarrierTask execution if the
transaction commits. Most related projects rely on monkey patching
Django’s database backends to provide post commit hooks, which results
in a race: they (non-atomically) commit the transaction and then execute
the post commit hook, so they do not guarantee task execution.As noted above, if an application synchrnously executes a
TransactionBarrierTask (e.g., with Celery eager mode) within a
transaction, the task executes immediately without waiting for the
transaction to commit.Testsdockerbuild-ttests.&&dockerruntestsTODOAdd support for a mysql backend.
Package: django-transaction-hooks
This project has been merged into Django and is now core functionality in
all supported versions of Django. Use the version built-in to Django; this
standalone app is unmaintained.
CHANGES
=======0.3 (2020.03.15)Formally deprecate and archive the project; it is included as part of all
Django versions since 1.9. Use the version included in Django and report any
bugs or issues to Django; this standalone app is not maintained.Drop support for Python 2.6, Python 3.2, and Django 1.6.0.2 (2014.11.29)Add built-in PostGIS backend. Merge of GH-16, fixes GH-14. Thanks Bertrand
Bordage.0.1.4 (2014.05.27)Make it possible to execute a transaction within an on-commit hook (except on
SQLite). Merge of GH-9, fixes GH-8. Thanks Marek Malek.0.1.3 (2014.01.24)Fix failure when mixing-in with database backends that perform queries in__init__(e.g. PostGIS backend whenPOSTGIS_VERSIONsetting is not
set). Merge of GH-6, fixes GH-5. Thanks Niels Sandholt Busch.0.1.2 (2014.01.21)Fix bug where running queries in anon_commithook under Postgres caused
an “autocommit cannot be used inside a transaction” error. (GH-4).0.1.1 (2014.01.18)Clear run-on-commit hooks even if one raises an exception. Thanks akaariai.0.1 (2014.01.18)Initial working version; support for SQLite3, PostgreSQL, MySQL.