{"id":24603613,"url":"https://github.com/apkawa/django-snapshot-field","last_synced_at":"2026-02-08T23:03:47.385Z","repository":{"id":57422062,"uuid":"126339635","full_name":"Apkawa/django-snapshot-field","owner":"Apkawa","description":"Snapshot model to field","archived":false,"fork":false,"pushed_at":"2025-01-11T06:49:14.000Z","size":63,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-16T22:05:05.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Apkawa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-22T13:30:09.000Z","updated_at":"2025-01-11T06:49:18.000Z","dependencies_parsed_at":"2022-09-06T07:12:13.992Z","dependency_job_id":null,"html_url":"https://github.com/Apkawa/django-snapshot-field","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-snapshot-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-snapshot-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-snapshot-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-snapshot-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apkawa","download_url":"https://codeload.github.com/Apkawa/django-snapshot-field/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251886773,"owners_count":21659932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-24T15:15:07.250Z","updated_at":"2026-02-08T23:03:47.351Z","avatar_url":"https://github.com/Apkawa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![ci](https://github.com/Apkawa/django-snapshot-field/actions/workflows/ci.yml/badge.svg)](https://github.com/Apkawa/django-snapshot-field/actions/workflows/ci.yml)\n\n[![PyPi](https://img.shields.io/pypi/v/django-snapshot-field.svg)](https://pypi.python.org/pypi/django-snapshot-field)\n[![PyPI](https://img.shields.io/pypi/pyversions/django-snapshot-field.svg)](https://pypi.python.org/pypi/django-snapshot-field)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nA field in a model that stores a snapshot of a model object and retrieves it as a read-only model object\n\n# Installation\n\n```bash\npip install django-snapshot-field\n```\n\nor from git\n\n```bash\npip install -e git+https://githib.com/Apkawa/django-snapshot-field.git#egg=django-snapshot-field\n```\n\n## Django and python version compatibles\n\n\n| Python\u003cbr/\u003eDjango | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 | 3.13 |\n|:-----------------:|-----|----|------|------|------|------|\n|        4.2        | ✅   | ✅  | ✅    | ✅    | ✅    | ✅    |\n|        5.0        | ❌   | ❌   | ✅    | ✅    | ✅    | ✅    |\n|        5.1        | ❌   | ❌   | ✅    | ✅    | ✅    | ✅    |\n|        5.2        | ❌   | ❌   | ✅    | ✅    | ✅    | ✅    |\n\n\n\n# Usage\n\n```python\nfrom django.db import models\nfrom snapshot_field.fields import SnapshotModelField\n\nclass Example(models.Model):\n    name = models.CharField(max_length=20)\n\nclass ExampleReference(models.Model):\n    name = models.CharField(max_length=20)\n    ref = models.ForeignKey(Example)\n\n\nclass ExampleSnapshotModel(models.Model):\n    snapshot = SnapshotModelField(null=True)\n    snapshot_refs = SnapshotModelField(\n        ['tests.Example', ['ExampleReference', {'fields': ['name', 'ref'], 'refs': ['ref']}]]\n    )\n\n\nobj = Example.objects.create(name='test_name')\nobj_ref = ExampleReference.objects.create(name='refname', ref=obj)\n\nsnap = ExampleSnapshotModel.objects.create(snapshot=obj, snapshot_refs=obj_ref)\n\nassert snap.snapshot.name == obj.name\nassert snap.snapshot_refs.name == obj_ref.name\nassert snap.snapshot_refs.ref.name == obj.name\n\nobj.delete()\nobj_ref.delete()\nsnap.refresh_from_db()\n\nassert snap.snapshot.name == obj.name\nassert snap.snapshot_refs.name == obj_ref.name\nassert snap.snapshot_refs.ref.name == obj.name\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapkawa%2Fdjango-snapshot-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapkawa%2Fdjango-snapshot-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapkawa%2Fdjango-snapshot-field/lists"}