{"id":16624291,"url":"https://github.com/dcramer/django-idmapper","last_synced_at":"2025-03-16T22:30:41.080Z","repository":{"id":458992,"uuid":"83041","full_name":"dcramer/django-idmapper","owner":"dcramer","description":"An identify mapper for the Django ORM","archived":false,"fork":false,"pushed_at":"2012-02-02T01:30:35.000Z","size":126,"stargazers_count":71,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-15T15:17:39.833Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcramer.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-12-01T11:19:26.000Z","updated_at":"2024-08-16T16:00:29.000Z","dependencies_parsed_at":"2022-07-07T23:38:51.461Z","dependency_job_id":null,"html_url":"https://github.com/dcramer/django-idmapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcramer%2Fdjango-idmapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcramer%2Fdjango-idmapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcramer%2Fdjango-idmapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcramer%2Fdjango-idmapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcramer","download_url":"https://codeload.github.com/dcramer/django-idmapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830952,"owners_count":20354854,"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":"2024-10-12T03:45:50.706Z","updated_at":"2025-03-16T22:30:40.796Z","avatar_url":"https://github.com/dcramer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This fork of django-idmapper fixes some bugs that prevented the idmapper from\nbeing used in many instances. In particular, the caching manager is now inherited\nby SharedMemoryManager subclasses, and it is used when Django uses an automatic\nmanager (see http://docs.djangoproject.com/en/dev/topics/db/managers/#controlling-automatic-manager-types). This means access through foreign keys now uses\nidentity mapping.\n\nTested with Django version 1.2 alpha 1 SVN-12375.\n\nMy modifications are usually accompanied by comments marked with \"CL:\".\n\nDjango Identity Mapper\n======================\n\nA pluggable Django application which allows you to explicitally mark your models to use an identity mapping pattern. This will share instances of the same model in memory throughout your interpreter.\n\nPlease note, that deserialization (such as from the cache) will *not* use the identity mapper.\n\nUsage\n-----\nTo use the shared memory model you simply need to inherit from it (instead of models.Model). This enable all queries (and relational queries) to this model to use the shared memory instance cache, effectively creating a single instance for each unique row (based on primary key) in the queryset.\n\nFor example, if you want to simply mark all of your models as a SharedMemoryModel, you might as well just import it as models.\n::\n\n\tfrom idmapper import models\n\n\tclass MyModel(models.SharedMemoryModel):\n\t    name = models.CharField(...)\n\nBecause the system is isolated, you may mix and match SharedMemoryModels with regular Models. The module idmapper.models imports everything from django.db.models and only adds SharedMemoryModel, so you can simply replace your import of models from django.db.\n::\n\n\tfrom idmapper import models\n\n\tclass MyModel(models.SharedMemoryModel):\n\t    name = models.CharField(...)\n\t    fkey = models.ForeignKey('Other')\n\n\tclass Other(models.Model):\n\t    name = models.CharField(...)\n\nReferences\n----------\n\nOriginal code and concept: http://code.djangoproject.com/ticket/17","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcramer%2Fdjango-idmapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcramer%2Fdjango-idmapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcramer%2Fdjango-idmapper/lists"}