Saravanan666/pypi-org huggingface dataset:
Package: django-model-tracker
django-model-trackerTrack model object changes over time so that you know who done what.InstallationInstall the packageFor Django<4.0pipinstall'django-model-tracker jsonfield'For Django>=4.0pipinstall'django-model-tracker'Add Application to your project's INSTALLED_APPsINSTALLED_APPS=('....','ModelTracker',)Add the following line to your urls.pyimportModelTrackerurlpatterns=patterns('',...url(r'^track/',include('ModelTracker.urls')),...)Run Migrationspythonmanage.pymigrateModelTrackerAdd the following line to your models.py filefromModelTrackerimportTrackerConvert each Model you want to track to inhert fromTracker.ModelTrackerinstead ofmodels.ModelOld CodeclassEmployee(models.Model):name=models.CharField(max_length=255)address=models.CharField(max_length=255)age=models.IntegerField()New CodeclassEmployee(Tracker.ModelTracker):name=models.CharField(max_length=255)address=models.CharField(max_length=255)age=models.IntegerField()For each save() call, add the user the usernameOld Codeemp=Employee()emp.save()* New Codeemp=Employee()emp.save(request.user.username)Starting from version of 0.5, you can pass a event_name parameter to mark change as an eventNew Codeemp=Employee()emp.save(request.user.username,event_name="Created the user")Using The MiddlewareYou can addModelTracker.middleware.ModelTrackerMiddlewareto your Middleware classes to get the username automatically from the request.MIDDLEWARE_CLASSES=('....','ModelTracker.middleware.ModelTrackerMiddleware',)Note:If you pass username asNonethen the change won't be saved.Showing Record HistoryThere are 3 ways to see the history of a recordgo toModelTrackerurl and selectTableand enterid.callshowModelChangesby POST and sendcsrftokenmiddlewareto return history as html.callgetModelChangeswhich returns history as Json.Django AdminThere is 2 ways to update an object by django adminHandle save and delete in ModelAdmin as followsdefsave_model(self,request,obj,form,change):obj.save(request.user.username,"Editing From admin interface")defdelete_model(self,request,obj):obj.delete(username=request.user.username,event_name="Deleting From admin interface")Inhert from TrackerAdmin rather ModelAdminfromModelTracker.TrackerimportTrackerAdminadmin.site.register(employee,TrackerAdmin)
Package: django-modeltrans
django-modeltransTranslates Django model fields in aJSONFieldusing a registration approach.Features/requirementsUses one PostgreSQLjsonb-field per model.
(django.contrib.postgres.JSONFieldfor Django<3.1,django.db.models.JSONFieldfor Django>=3.1)Django 2.2, 3.0, 3.1, 3.2, 4.0 (with their supported python versions)PostgreSQL >= 9.5 and Psycopg2 >= 2.5.4.Available on pypiDocumentationRunning the teststoxRunning the tests only for the current environment, usemake testAttributionSome concepts and code come fromhttps://github.com/deschler/django-modeltranslation,
which is in turn inspired byhttps://github.com/zmathew/django-linguoWe started this solution at Zostera because we did not like:The way django-modeltranslation adds one field per language (and thus requires a migration
when adding a language);The unpredictability of the original field.SinceJSONBis supported by Postgres now, we developed this approach.Relevant 3rd party documentationPostgreSQL jsonb functions
Package: django-modeltranslation
War in UkraineOn February 24th, 2022, Russia invaded Ukraine. I’m sole maintainer of this project
staying in safe place, but i don’t know how long it would be safe.Russian military shelling our cities, targeting civilian population.Help Ukraine:https://supportukrainenow.org/Talk to your politics, talk to your friends. Send heavy weapons to Ukraine. Close the sky.ModeltranslationThe modeltranslation application is used to translate dynamic content of
existing Django models to an arbitrary number of languages without having to
change the original model classes. It uses a registration approach (comparable
to Django’s admin app) to be able to add translations to existing or new
projects and is fully integrated into the Django admin backend.The advantage of a registration approach is the ability to add translations to
models on a per-app basis. You can use the same app in different projects,
may they use translations or not, and you never have to touch the original
model class.FeaturesAdd translations without changing existing models or viewsTranslation fields are stored in the same table (no expensive joins)Supports inherited models (abstract and multi-table inheritance)Handle more than just text fieldsDjango admin integrationFlexible fallbacks, auto-population and more!For the latest documentation, visithttps://django-modeltranslation.readthedocs.io/en/latest/.
Package: django-modeltranslation-rosetta
Project for interface translate fields like django-rosettaInstallationpipinstalldjango-modeltranslation-rosettaor from gitpipinstall-egit+https://githib.com/Apkawa/django-modeltranslation-rosetta.git#egg=django-modeltranslation-rosettaDjango and python versionPythonDjango3.73.83.93.102.2✅✅✅✅3.2✅✅✅✅4.0❌✅✅✅UsageAddmodeltranslation_rosettaintoINSTALLED_APPSaftermodeltranslationsettings.pyINSTALLED_APPS=[# ...'modeltranslation','modeltranslation_rosetta',# ...]Open/admin/modeltranslation_rosetta/trans/
Package: django-modeltranslation-wagtail
Keep-it-simple glue between django-modeltranslation and Wagtail.FeaturesField-based translation for Wagtail using django-modeltranslationTODOMakes translated fields easily accessible to the Wagtail admin.Sensible to the currently activated language.ThePagemodel isn’t modified (no migrations added to Wagtail), translations oftitle,seo_titleandsearch_descriptionare local to the translated models.How to useYou create Wagtail models and activate them with a<yourapp>.translationmodule, just like you would with any other modeltranslation-based model.In Wagtail, it’s the active language that decides what language you are editing in your translated model.For instance, navigating to/en/wagtail/pages/add/<yourapp>/<yourmodel>/<ptr_id>/will create a new page in English.Drawback: There is currently no UI for the translation workflow. This means that users have toknowthat they need to switch/en/with/fr/in the URL path after creating an English entry to edit it in French.When to use thisActually, you might not want to use this! Consider carefully to usewagtail-modeltranslationas it has
substantially improved by not hard-copyingdjango-modeltranslationanymore.If you need to have 1:1 translation for Pages or Snippets in Wagtail, you could use django-modeltranslation.
However,wagtail-modeltranslationis a complex project that patches a lot of external code and therefore often breaks with the latest versions of Wagtail.If you only need freeform translation (when pages in the page-tree aren’t translated 1:1 but translations exist independently from one another), look no further than either Wagtail’s built-insimple_translationorwagtail-localize.BackgroundOriginally, I was usingwagtail-modeltranslation.
The project has been sparsely maintained, but more seriously, it was monkey-patching Wagtail and using a hard-copy
of the modeltranslation codebase instead of a dependency reference to django-modeltranslation. The latter has
now been restored, which as lowered the motivation for this project.A few years later, I returned to use wagtail-modeltranslation but once again found myself spending way too much time understanding non-merged PRs etc. To be fair, the project has been maintained in the meantime, but it was lacking behind and I couldn’t figure out what to do to use it with the latest version of Wagtail.This project introduces a bit of naming hell. But remember it like this:django-modeltranslation-wagtailhas
wagtail at the end because it depends ondjango-modeltranslation, which depends ondjango.Using django-modeltranslation or wagtail-modeltranslation?Switching is easy!Since this project is directly based on django-modeltranslation, the creation of fields in the database and
django migrations remains the same. In case you are switching, just revisit yourtranslation.pyfiles
and change the imports to point tomodeltranslation_wagtail.
Package: django-modeltranslation-xliff
XLIFF Exchange is an extension fordjango-modeltranslationpackage that allows to export
translatable content inOASIS XLIFF1.2 format supported by most translation
tools and import content in target languages from translated XLIFF files.Export action and Import form in Django adminIntroductionDjango has good support for translating UI elements but lacks support for translating
dynamic content stored in a database. There are a number of third-party packages
for that purpose, includingdjango-modeltranslationthat uses registration
approach for adding translations to Django model fields. It also provides admin classes
that allow to enter translations for model fields directly in Django admin interface.
However, with large volumes of content and many translation languages such direct
content manipulation can be quite cumbersome. XLIFF Exchange for django-modeltranslation
simplifies translation management by providing an admin action for bulk exporting
translatable content to XLIFF 1.2 format and a form for uploading translated XLIFF
files.XLIFF 1.2 files are supported bu most (if not all) offline and online translation tools,
includingSDL Trados,Deja Vu,memoQ,Transifex,SmartCATand many others.
You can simply export your content to XLIFF files, give them to your in-house
or external translators to translate, and then import translated contend back
to your Django project. Translatable fields in respective languages
will be updated automatically.CompatibilityPython: 3.4-3.7Django: 1.11-2.1django-modeltranslation: 0.13-beta1 and aboveNote: some Python/Django combinations may not work. You can find compatible
combinations intox.inifile.InstallationInstall XLIFF Exchange withpip:pip install django-modeltranslation-xliffAdd'modeltranslation_xliff'toINSTALLED_APPSin your project’ssettings.py:INSTALLED_APPS=('modeltranslation','modeltranslation_xliff',...)UsageXLIFF Exchange for django-modeltranslation providesXliffExchangeMixinclass
formodeltranslation.admin.TranslationAdminthat adds XLIFF export/import
functionality.Minimal example:fromdjango.contribimportadminfrommodeltranslation.adminimportTranslationAdminfrommodeltranslation_xliffimportXliffExchangeMixinfrom.modelsimportMyModel@admin.register(MyModel)classMyModelAdmin(XliffExchangeMixin,TranslationAdmin):passXliffExchangeMixinclass is compatible withTranslationAdminand its
child classes, e.g.TabbedTranslationAdmin.DocumentationSeeXLIFF Exchange documentationfor more info.LicenseMIT. SeeLICENSE.txt.
Package: django-modeltree
AboutDo you have a model layout with various relations and looking for a way to
navigate it with ease? Then django-modeltree is what you are looking for. Build
your modeltree in a single line and accessing related models and their objects
in a elegant and performant way. No need for complex query building anymore.
Find out how this workshere.LinksGithubDocsInstallationInstall from pypi.org:pip install django-modeltree
Package: django-model-validators
Django Model Validators=======================Django model validators adds a few common validators in addition to Django's [built-in validators](https://docs.djangoproject.com/en/dev/ref/validators/).Installation------------Run `pip install django-model-validators`Validators----------###FileTypeValidatorEnsures an upload file name ends in an extension.```pythonfrom django.db import modelsfrom model_validators.validators import FileTypeValidatorclass MyModel(models.Model):even_field = models.IntegerField(validators=[FileTypeValidator('zip')])```It can also be passed a list of extensions:```pythonfrom django.db import modelsclass MyModel(models.Model):even_field = models.IntegerField(validators=[FileTypeValidator(['zip', 'txt', 'pdf'])])```###NumericRangeValidatorEnsure the field value falls within the specified range.```pythonfrom django.db import modelsfrom model_validators.validators import NumericRangeValidatorclass MyModel(models.Model):rating = models.PositiveIntegerField(validators=[NumericRangeValidator(1, 10)])```
Package: django-model-values
Djangomodel utilities for encouraging direct data access instead of unnecessary object overhead. Implemented through compatible method and operator extensions toQuerySetsandManagers.The goal is to provide elegant syntactic support for best practices in using Django's ORM. Specifically avoiding the inefficiencies and race conditions associated with always using objects.UsageTypical model usage is verbose, inefficient, and incorrect.book=Book.objects.get(pk=pk)book.rating=5.0book.save()The correct method is generally supported, but arguably less readable.Book.objects.filter(pk=pk).update(rating=5.0)model_valuesencourages the better approach with operator support.Book.objects[pk]['rating']=5.0Similarly for queries:(book.ratingforbookinbooks)books.values_list('rating',flat=True)books['rating']Column-oriented syntax is common in panel data layers, and the greater expressiveness cascades.QuerySetsalso support aggregation and conditionals.books.values_list('rating',flat=True).filter(rating__gt=0)books['rating']>0books.aggregate(models.Avg('rating'))['rating__avg']books['rating'].mean()Managersprovide a variety of efficient primary key based utilities. To enable, instantiate theManagerin your models. As with any customManager, it doesn't have to be namedobjects, but it is designed to be a 100% compatible replacement.frommodel_valuesimportManagerclassBook(models.Model):...objects=Manager()Fexpressions are also enhanced, and can be used directly without model changes.frommodel_valuesimportF.filter(rating__gt=0,last_modified__range=(start,end)).filter(F.rating>0,F.last_modified.range(start,end))Installation%pipinstalldjango-model-valuesTests100% branch coverage.%pytest[--cov]
Package: django-model-versions
django-model-versionsA library for adding version information to models. This version information
is then used to prevent concurrent modifications. E.g.>>> b1 = Blog.objects.get(id=1)
>>> b2 = Blog.objects.get(id=1) # Same row as b1
>>> b1.title = 'Some blog'
>>> b1.save()
>>> b2.title = 'Some other blog'
>>> b2.save()Will result in a ConcurrentModificationException being raised instead of
overriding the data saved by b1.UsageSubclass modelversions.VersionedModel instead of django.db.models.Model.
That’s it!Known flawsobjects.update(…) will not increment the version number for objects altered.
This would be better as a mixin.
object.delete() will not check versioning
Django admin hates itAuthorColin Howe <colin@colinhowe.co.uk>http://www.colinhowe.co.uk- @colinhowe
Package: django-modelwithlog
django-modelwithlog-------------------django-modelwithlog is a reusable Django Abstract Model that make automatic history log of your model.The History of all model will write in a Model RegisterLog compose of:action_time:date and time of ocurrencycontent_type:The ContentType of the concrect Modeldata_user:A JSON of user and acess data loged on ocurrencymodifications:A JSON with a data of model modificateobject_pk:The primary key of modelobject_repr:The representation of modelaction_flag:The action of ocurrency (ADDITION, CHANGE or DELETION)change_message:The message of ocurrency of human readSetup/Usage===========.. code-block:: shellpip install django-modelwithlogor.. code-block:: shellpip install git+https://github.com/bispogeomk/django-modelwithlogAdd `threadlocals.middleware.ThreadLocalMiddleware` to your `MIDDLEWARE_CLASSES` setting.Add 'log_models' to your 'SETTINGS.INSTALLED_APPS'.Inherit your model from 'ModelWithLog' to make it auto logged:.. code-block:: pythonfrom django.db import modelsfrom log_models import ModelWithLogclass MyModel(ModelWithLog):name = models.CharField(max_length=80)age = models.PositiveSmallIntegerField()Advanced Usage--------------.. code-block:: pythonfrom django.db import modelsfrom log_models.models import ModelWithLogfrom log_models.models import RegisterLogfrom django.contrib.contenttypes.models import ContentTypeclass Player(ModelWithLog):name = models.CharField(max_length=80)age = models.PositiveSmallIntegerField()def make_log_message(self):self.full_clean()if self.__action_flag__ == 1:return f"A new Player nome {self.nome} with age {self.age}."elif self.__action_flag__ == 3:return f"Player {self.nome} is gone."else:return f"The Player change for {self.nome} and age {self.age}."def get_logs(self):return RegisterLog.objects.filter(content_type=ContentType(Player), object_pk=self.pk)Compatibility--------------django-modelwithlog aims to support the same versions of Django currently maintained by the main Django project. See `Django supported versions`_, currently:* Django 1.10 with Python 3.5* Django 1.11 (LTS) with Python 3.5 or 3.6Testing django-modelwithlog Locally--------------------------------To test against all supported versions of Django:.. code-block:: shell$ python setup.py testContact-------Web: http://www.snaketi.com.brTwitter: `@moacirbispo`_Email: `bispo@geomk.com.br`_.. _bispo@geomk.com.br: mailto:bispo@geomk.com.br.. _@moacirbispo: https://twitter.com/moacirbispoChanges-------Take a look at the `changelog`_... _changelog: https://github.com/bispogeomk/django-modelwithlog/blob/master/CHANGES.rst
Package: django-model-ya-publisher
Django model mixins and utilities for a standard publisher workflow.This is a fork ofandersinno/django-model-publisher-aiwitch is a fork of the originwearehoods/django-ya-model-publisher.travis-ci.org/wearehoods/django-ya-model-publishercoveralls.io/r/wearehoods/django-ya-model-publisherlandscape.io/github/wearehoods/django-ya-model-publisher/masterFeaturesDjango CMS placeholders support.Hvad/Parler support.Restrict user access to publish functions with user permissions.RoadmapImplement a “request/reject/accept publishing” workflow with a shot messages and loggingDjango compatibilitydjango-ya-model-publisherdjango versionpythonv0.0.x1.8, 1.112.7, 3.4, 3.5TODO: Update travis configs.historyv0.0.1 - 14.11.2017Just create the fork and apply all pull requests fromandersinno/django-model-publisher-ai/pull/14linksHomepagehttp://github.com/wearehoods/django-ya-model-publisherPyPihttp://pypi.python.org/pypi/django-ya-model-publisher/donationpaypal.me/JensDiemerFlattr This!SendBitcoinsto1823RZ5Md1Q2X5aSXRC5LRPcYdveCiVX6F
Package: django-moderation-model-mixin
This package adds the possibility of handle a moderation to django models and associated admins.
This means being able to mark an entry as accepted, rejected or to be moderated (default).
Querysets, Managers and Signals are included.DocumentationThe full documentation is athttps://django-moderation-model-mixin.readthedocs.io.QuickstartInstall Django Moderation Model Mixin:pip install django-moderation-model-mixinAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'moderation_model_mixin',...)FeaturesModerationModelMixinModerationModelMixinAdminModerableQuerySetActions in admin changelistSignals associated to moderation actionExample of usage# in your admin.pyclassExampleModelAdmin(ModerationModelMixinAdmin,admin.ModelAdmin):...admin.site.register(ExampleModel,ExampleModelAdmin)# in your models.pyfrommoderation_model_mixin.modelsimportModerationModelMixinclassExampleModel(ModerationModelMixin,models.Model):...Admin InterfaceHere some users interface example.First one is how the change form is shown. There are two new buttons in the submit row that allows to accept or reject entries that not yet moderated.This is how an accepted entry looks.This is how a rejected entry looks.A confirmation pop-up is shown when an acceptance or rejection request is madeLast image shows actions in the changelist.Running TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxDevelopment commandspip install -r requirements_dev.txt
invoke -lCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2021-11-12)First release on PyPI.
Package: django-modern-admin
===================django_modern_admin===================DjangoModernAdmin is a materialize Django admin extension to for your web apps.With DjangoModernAdmin your dashboard will be more powerful and had a wonderful design.Detailed documentation is in the "docs" directory.Quick start-----------1. Add “django_modern_admin” to your INSTALLED_APPS setting like this::INSTALLED_APPS = [‘django.contrib.auth’,‘django_modern_admin’,‘django.contrib.admin’,‘... ‘]2. Requirements: Pillow, oauth2client3. Run `python manage.py migrate` to create the django_modern_admin models.4. You must define in settings.pyGOOGLE_ANALYTICS_SERVICE_ACCOUNT_JSON = os.path.join(BASE_DIR, ‘xxx.json’)GOOGLE_ANALYTICS_ID = ‘123456789’5. If you want to use charts you should set chart model and field in settings.pyFor Top Left Line Chart:TOP_LEFT_CHART = {'title': 'Revenue','baseChartModel': 'Orders.Orders','baseChartLineField': 'orderTotal','baseChartDateField': 'orderDate','doughnutChartNameField': 'orderCategory','doughnutChartValueField': 'orderTotal','tableFieldsForDay': {'orderQty', 'productPrice', 'orderTotal'},'tableFieldsForMonth': {'orderQty', 'orderTotal'}}For Mini Bar Charts:MINI_BAR_CHART = {'first': {'icon': 'mdi-action-account-child', # optional'chartModel': 'auth.User','chartModelDateField': 'date_joined','color': 'green',},'second': {# 'icon': '', # optional'chartModel': 'Orders.Orders','chartModelDateField': 'orderDate','color': 'deep-purple',},'third': {'icon': 'mdi-action-announcement', # optional'chartModel': 'auth.User','chartModelDateField': 'date_joined','color': 'blue-grey',},'fourth': {# 'icon': '', # optional'chartModel': 'Orders.Orders','chartModelDateField': 'orderDate','color': 'orange'}}For jVectorMap:VECTOR_MAP_JS_URL = '/static/js/plugins/jvectormap/jvector-turkey.js'For Left and Right Model List:MODEL_LIST = {'left': {'modelIcon': 'mdi-content-select-all','modelName': 'Products.Products','listFields': {'name', 'price', },'filterField': 'price__lte', # optional'filterValue': '400', # optional'orderField': 'price',},'right': {'modelName': 'Orders.Orders','listFields': ['product', 'orderQty'],'orderField': 'orderDate'}}Footer Copyright:FOOTERCOPYRIGHT = ‘Django Modern Admin’ # optionalSite Title:SITE_TITLE = ‘Django Modern Admin Administration’Site Header:SITE_HEADER = ‘Django Modern Admin Header’Index Title:INDEX_TITLE = ‘Django Modern Admin Index’6. Visit http://127.0.0.1:8000/admin/ to see the magic.