diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-10 08:59:17 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 08:59:17 +0000 |
| commit | 99fc293ff24c585ce2908774a247e391b6b74885 (patch) | |
| tree | c9504aa15ffd69745c7a285ee08e91e4063f80fa | |
| parent | 9c6c7e1f0caa54ddc5cfa932f73790f2e2b2d7aa (diff) | |
automatic import of python-django-pghistory
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-django-pghistory.spec | 156 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 158 insertions, 0 deletions
@@ -0,0 +1 @@ +/django_pghistory-2.7.0.tar.gz diff --git a/python-django-pghistory.spec b/python-django-pghistory.spec new file mode 100644 index 0000000..927ea04 --- /dev/null +++ b/python-django-pghistory.spec @@ -0,0 +1,156 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-pghistory +Version: 2.7.0 +Release: 1 +Summary: History tracking for Django and Postgres +License: BSD-3-Clause +URL: https://github.com/Opus10/django-pghistory +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d9/85/d551c0353358902263f126014e3054567dc0a12100bb0ff132ce8f7307b9/django_pghistory-2.7.0.tar.gz +BuildArch: noarch + +Requires: python3-django +Requires: python3-importlib_metadata +Requires: python3-django-pgtrigger + +%description +Decorate your model with ``pghistory.track``. For example: + import pghistory + @pghistory.track(pghistory.Snapshot()) + class TrackedModel(models.Model): + int_field = models.IntegerField() + text_field = models.TextField() +Above we've registered a ``pghistory.Snapshot`` event tracker to ``TrackedModel``. +This event tracker stores every change in a dynamically-created +model that mirrors fields in ``TrackedModel``. +Run ``python manage.py makemigrations`` followed by ``migrate`` and +*voila*, every change to ``TrackedModel`` is now stored. This includes bulk +methods and even changes that happen in raw SQL. For example: + from myapp.models import TrackedModel + # Even though we didn't declare TrackedModelEvent, django-pghistory + # creates it for us in our app + from myapp.models import TrackedModelEvent + m = TrackedModel.objects.create(int_field=1, text_field="hello") + m.int_field = 2 + m.save() + print(TrackedModelEvent.objects.values("pgh_obj", "int_field")) + > [{'pgh_obj': 1, 'int_field': 1}, {'pgh_obj': 1, 'int_field': 2}] +Above we printed the ``pgh_obj`` field, which is a special foreign key to the tracked +object. There are a few other special ``pgh_`` fields that we'll discuss later. +``django-pghistory`` can track a subset of fields and conditionally store events +based on specific field transitions. Users can also store free-form context +from the application that's referenced by the event model, all with no additional +database queries. See the next steps below on how to dive deeper and configure it +for your use case. + +%package -n python3-django-pghistory +Summary: History tracking for Django and Postgres +Provides: python-django-pghistory +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-pghistory +Decorate your model with ``pghistory.track``. For example: + import pghistory + @pghistory.track(pghistory.Snapshot()) + class TrackedModel(models.Model): + int_field = models.IntegerField() + text_field = models.TextField() +Above we've registered a ``pghistory.Snapshot`` event tracker to ``TrackedModel``. +This event tracker stores every change in a dynamically-created +model that mirrors fields in ``TrackedModel``. +Run ``python manage.py makemigrations`` followed by ``migrate`` and +*voila*, every change to ``TrackedModel`` is now stored. This includes bulk +methods and even changes that happen in raw SQL. For example: + from myapp.models import TrackedModel + # Even though we didn't declare TrackedModelEvent, django-pghistory + # creates it for us in our app + from myapp.models import TrackedModelEvent + m = TrackedModel.objects.create(int_field=1, text_field="hello") + m.int_field = 2 + m.save() + print(TrackedModelEvent.objects.values("pgh_obj", "int_field")) + > [{'pgh_obj': 1, 'int_field': 1}, {'pgh_obj': 1, 'int_field': 2}] +Above we printed the ``pgh_obj`` field, which is a special foreign key to the tracked +object. There are a few other special ``pgh_`` fields that we'll discuss later. +``django-pghistory`` can track a subset of fields and conditionally store events +based on specific field transitions. Users can also store free-form context +from the application that's referenced by the event model, all with no additional +database queries. See the next steps below on how to dive deeper and configure it +for your use case. + +%package help +Summary: Development documents and examples for django-pghistory +Provides: python3-django-pghistory-doc +%description help +Decorate your model with ``pghistory.track``. For example: + import pghistory + @pghistory.track(pghistory.Snapshot()) + class TrackedModel(models.Model): + int_field = models.IntegerField() + text_field = models.TextField() +Above we've registered a ``pghistory.Snapshot`` event tracker to ``TrackedModel``. +This event tracker stores every change in a dynamically-created +model that mirrors fields in ``TrackedModel``. +Run ``python manage.py makemigrations`` followed by ``migrate`` and +*voila*, every change to ``TrackedModel`` is now stored. This includes bulk +methods and even changes that happen in raw SQL. For example: + from myapp.models import TrackedModel + # Even though we didn't declare TrackedModelEvent, django-pghistory + # creates it for us in our app + from myapp.models import TrackedModelEvent + m = TrackedModel.objects.create(int_field=1, text_field="hello") + m.int_field = 2 + m.save() + print(TrackedModelEvent.objects.values("pgh_obj", "int_field")) + > [{'pgh_obj': 1, 'int_field': 1}, {'pgh_obj': 1, 'int_field': 2}] +Above we printed the ``pgh_obj`` field, which is a special foreign key to the tracked +object. There are a few other special ``pgh_`` fields that we'll discuss later. +``django-pghistory`` can track a subset of fields and conditionally store events +based on specific field transitions. Users can also store free-form context +from the application that's referenced by the event model, all with no additional +database queries. See the next steps below on how to dive deeper and configure it +for your use case. + +%prep +%autosetup -n django-pghistory-2.7.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-django-pghistory -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 2.7.0-1 +- Package Spec generated @@ -0,0 +1 @@ +2c80686cd9c80053a17ed5cfac419952 django_pghistory-2.7.0.tar.gz |
