{ "info": { "author": "Bispo", "author_email": "bispo@geomk.com.br", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: System :: Logging" ], "description": "django-modelwithlog\n-------------------\n\ndjango-modelwithlog is a reusable Django Abstract Model that make automatic history log of your model.\n\nThe History of all model will write in a Model RegisterLog compose of:\n\n action_time:\n date and time of ocurrency\n\n content_type:\n The ContentType of the concrect Model\n\n data_user:\n A JSON of user and acess data loged on ocurrency\n\n modifications:\n A JSON with a data of model modificate\n\n object_pk:\n The primary key of model\n\n object_repr:\n The representation of model\n\n action_flag:\n The action of ocurrency (ADDITION, CHANGE or DELETION)\n\n change_message:\n The message of ocurrency of human read\n\nSetup/Usage\n===========\n\n.. code-block:: shell\n\n pip install django-modelwithlog\n\nor\n\n.. code-block:: shell\n\n pip install git+https://github.com/bispogeomk/django-modelwithlog\n\n\nAdd `threadlocals.middleware.ThreadLocalMiddleware` to your `MIDDLEWARE_CLASSES` setting.\n\nAdd 'log_models' to your 'SETTINGS.INSTALLED_APPS'.\n\nInherit your model from 'ModelWithLog' to make it auto logged:\n\n.. code-block:: python\n\n from django.db import models\n from log_models import ModelWithLog\n\n class MyModel(ModelWithLog):\n name = models.CharField(max_length=80)\n age = models.PositiveSmallIntegerField()\n\nAdvanced Usage\n--------------\n\n.. code-block:: python\n\n from django.db import models\n from log_models.models import ModelWithLog\n from log_models.models import RegisterLog\n from django.contrib.contenttypes.models import ContentType\n\n class Player(ModelWithLog):\n name = models.CharField(max_length=80)\n age = models.PositiveSmallIntegerField()\n\n def make_log_message(self):\n self.full_clean()\n if self.__action_flag__ == 1:\n return f\"A new Player nome {self.nome} with age {self.age}.\"\n elif self.__action_flag__ == 3:\n return f\"Player {self.nome} is gone.\"\n else:\n return f\"The Player change for {self.nome} and age {self.age}.\"\n\n def get_logs(self):\n return RegisterLog.objects.filter(content_type=ContentType(Player), object_pk=self.pk)\n\nCompatibility\n--------------\n\ndjango-modelwithlog aims to support the same versions of Django currently maintained by the main Django project. See `Django supported versions`_, currently:\n\n * Django 1.10 with Python 3.5\n * Django 1.11 (LTS) with Python 3.5 or 3.6\n\n\nTesting django-modelwithlog Locally\n--------------------------------\n\nTo test against all supported versions of Django:\n\n.. code-block:: shell\n\n $ python setup.py test\n\n\nContact\n-------\nWeb: http://www.snaketi.com.br\n\nTwitter: `@moacirbispo`_\n\nEmail: `bispo@geomk.com.br`_\n\n.. _bispo@geomk.com.br: mailto:bispo@geomk.com.br\n.. _@moacirbispo: https://twitter.com/moacirbispo\n\nChanges\n-------\n\nTake a look at the `changelog`_.\n\n.. _changelog: https://github.com/bispogeomk/django-modelwithlog/blob/master/CHANGES.rst", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bispogeomk/django-modelwithlog/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-modelwithlog", "package_url": "https://pypi.org/project/django-modelwithlog/", "platform": "", "project_url": "https://pypi.org/project/django-modelwithlog/", "project_urls": { "Homepage": "https://github.com/bispogeomk/django-modelwithlog/" }, "release_url": "https://pypi.org/project/django-modelwithlog/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "A reusable Django Model that allows you to storeregistre actions log of models.", "version": "1.0.1" }, "last_serial": 3749469, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "1d8ca78a05d4e265283d4376b3d58708", "sha256": "8ab9447b903fadfc43bca03b284c527d0f777c28933a0dd579ac9e065579a9c5" }, "downloads": -1, "filename": "django-modelwithlog-0.9.0.tar.gz", "has_sig": false, "md5_digest": "1d8ca78a05d4e265283d4376b3d58708", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6181, "upload_time": "2017-09-12T01:13:22", "url": "https://files.pythonhosted.org/packages/1d/4c/0afb7ef7392f271bf3c293cbc473b39e227e27d6d8f8a0619025cfff2dd2/django-modelwithlog-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "81b825e6c76000ee66fa0db25947fc26", "sha256": "74e239803b7405460e813b0e32e6c7ea0a3a7260201cfda3eddb9bfe9ded9444" }, "downloads": -1, "filename": "django-modelwithlog-0.9.1.tar.gz", "has_sig": false, "md5_digest": "81b825e6c76000ee66fa0db25947fc26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6695, "upload_time": "2017-09-12T19:27:07", "url": "https://files.pythonhosted.org/packages/2a/da/a69adfde25730b488216bb82445a9b83e2f703559cea91c0e080d7278272/django-modelwithlog-0.9.1.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "e5a29d667abfc60ed6e4fa052c844d7c", "sha256": "a011931592b93afe68df29fdfc9ebc64b06b05faacf9324a3e570e3e7adb1a4b" }, "downloads": -1, "filename": "django-modelwithlog-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e5a29d667abfc60ed6e4fa052c844d7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8515, "upload_time": "2018-04-09T18:07:44", "url": "https://files.pythonhosted.org/packages/42/1e/3a0d37162dbeb3af603df009d2721a146d064e0c2a19cf6aeae6758d8125/django-modelwithlog-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e5a29d667abfc60ed6e4fa052c844d7c", "sha256": "a011931592b93afe68df29fdfc9ebc64b06b05faacf9324a3e570e3e7adb1a4b" }, "downloads": -1, "filename": "django-modelwithlog-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e5a29d667abfc60ed6e4fa052c844d7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8515, "upload_time": "2018-04-09T18:07:44", "url": "https://files.pythonhosted.org/packages/42/1e/3a0d37162dbeb3af603df009d2721a146d064e0c2a19cf6aeae6758d8125/django-modelwithlog-1.0.1.tar.gz" } ] }