{"id":18899320,"url":"https://github.com/sachnaror/django-firebase-orm","last_synced_at":"2026-05-09T10:25:14.461Z","repository":{"id":218127966,"uuid":"745675577","full_name":"sachnaror/django-firebase-orm","owner":"sachnaror","description":"Django like models for NoSQL database Firestore Integrating with django's ORM.","archived":false,"fork":false,"pushed_at":"2024-01-19T21:15:31.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T09:14:59.468Z","etag":null,"topics":["django","firebase"],"latest_commit_sha":null,"homepage":"https://github.com/sachnaror","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sachnaror.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-19T21:10:15.000Z","updated_at":"2024-01-19T21:17:26.000Z","dependencies_parsed_at":"2024-01-19T22:37:22.160Z","dependency_job_id":"b33fff94-2216-42ac-b54c-9f62ead6cf54","html_url":"https://github.com/sachnaror/django-firebase-orm","commit_stats":null,"previous_names":["sachnaror/django-firebase-orm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachnaror%2Fdjango-firebase-orm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachnaror%2Fdjango-firebase-orm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachnaror%2Fdjango-firebase-orm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachnaror%2Fdjango-firebase-orm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sachnaror","download_url":"https://codeload.github.com/sachnaror/django-firebase-orm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239879307,"owners_count":19712176,"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":["django","firebase"],"created_at":"2024-11-08T08:46:12.830Z","updated_at":"2026-03-01T22:30:15.939Z","avatar_url":"https://github.com/sachnaror.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\n# django-firebase-orm.\n\nDjango like models for NoSQL database Firestore Integrating with\ndjango\\'s ORM.\n\nI made a few changes and improvements to suit my liking:\n\n1.  Created a second settings.py file in the root\n    of your django project to now only require that you define the\n    neccessary configurations in your project\\'s settings module. *Note\n    that django is now an explicit dependency*\n\n2.  Created a new package for this app on pypi under\n    **django-firebase-orm**\n\nIt is my desire to continue the development of this project and thus\nwelcome all developers wishing to contribute via improving\ndocumentation, bug fixes, test coverage, new features, etc.\n\nInstallation\n------------\n\n```shell\n$ pip install django-firebase-orm\n```\n\nInitialize\n----------\n\nIn your project settings add the following configuration variables\n\n\u003e settings.py\n\u003e\n```python\nFIREBASE_ORM_CERTIFICATE = 'path/to/serviceAccountKey.json'\nFIREBASE_ORM_BUCKET_NAME = '\u003cBUCKET_NAME\u003e.appspot.com'\n```\n\nFIREBASE_ORM_CERTIFICATE\n\n:   Once you have created a [Firebase\n    console](https://console.firebase.google.com/?authuser=0) project\n    and downloaded a JSON file with your service account credentials.\n\nFIREBASE_ORM_BUCKET_NAME\n\n:   The bucket name must not contain gs:// or any other protocol\n    prefixes. For example, if the bucket URL displayed in the [Firebase\n    console](https://console.firebase.google.com/?authuser=0) is\n    gs://bucket-name.appspot.com, pass the string\n    bucket-name.appspot.com\n\nUsage\n-----\n\n### Create model:\n\n```python\nfrom firebase_orm import models\n\n\nclass Article(models.Model):\n    headline = models.TextField()\n    type_article = models.TextField(db_column='type')\n\n    class Meta:\n        db_table = 'medications'\n\n    def __str__(self):\n        return self.headline\n```\n\n### Using The API:\n\n**Creating objects**\n\nTo represent cloud firestore data in Python objects, FirebaseORM uses an\nintuitive system: A *model* *class* represents a *collection*, and an\n*instance* of that class represents a *document* in collection.\n\nTo create an object, instantiate it using keyword arguments to the model\nclass, then call save() to save it to the database.\n\n```pycon\n# Import the models we created\n\u003e\u003e\u003e from models import Article\n# Create a new Article.\n\u003e\u003e\u003e a = Article(headline='Django is cool')\n# Save the object into the database. You have to call save() explicitly.\n\u003e\u003e\u003e a.save()\n```\n\n**Retrieving all objects**\n\nThe simplest way to retrieve documents from a collections is to get all\nof them. To do this, use the all() method on a Manager as you would in\nnormal django:\n\n```pycon\n\u003e\u003e\u003e all_Article = Article.objects.all()\n```\n\nThe all() method returns a list instance Article of all the collection\nin the database.\n\n```pycon\n# Now it has an ID.\n\u003e\u003e\u003e a.id\n1\n# Fields are represented as attributes on the Python object.\n\u003e\u003e\u003e a.headline\n'Django is cool'\n```\n\n**Saving changes to objects**\n\nTo save changes to an object that's already in the database, use save().\n\nGiven a Article instance a that has already been saved to the database,\nthis example changes its name and updates its record in the database:\n\n```pycon\n\u003e\u003e\u003e a.headline = 'Django-Firebase-ORM is awesome'\n\u003e\u003e\u003e a.save()\n```\n\nThis performs an document.update() method behind the scenes. FirebaseORM\ndoesn't hit the database until you explicitly call save().\n\n```pycon\n# Firebase ORM provides a rich database lookup API.\n\u003e\u003e\u003e Article.objects.get(id=1)\n\u003cArticle: Django-Firebase-ORM is awesome\u003e\n\u003e\u003e\u003e Article.objects.get(id=2)\nTraceback (most recent call last):\n    ...\nDoesNotExist: Article matching query does not exist.\n```\n\nField options:\n--------------\n\nThe following arguments are available to all field types. All are\noptional.\n\n**Field.db_column**\n\n\u003e If contains characters that aren't allowed in Python variable names --\n\u003e use db_column. The name of the firestore key in document to use for\n\u003e this field. If this isn't given, FirebaseORM will use the field's\n\u003e name.\n\nField types:\n------------\n\n### AutoField\n\n**class AutoField()**\n\n\u003e By default, FirebaseORM gives each model the following field:\n\u003e\n\n```python\nid = models.AutoField(primary_key=True)\n```\n\n### TextField\n\n**class TextField(**options)\\*\\*\n\n\u003e Text string Up to 1,048,487 bytes (1 MiB - 89 bytes). Only the first\n\u003e 1,500 bytes of the UTF-8 representation are considered by queries.\n\u003e\n\u003e TextField has not extra required argument.\n\nDependencies\n------------\n\n1.  *firebase-admin*\n2.  *grpcio*\n3.  *django*\n\n## Building from Source for Developers\n\n```console\n$ git clone https://github.com/sachnaror/django-firebase-orm\n$ cd django-firebase-orm\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachnaror%2Fdjango-firebase-orm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsachnaror%2Fdjango-firebase-orm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachnaror%2Fdjango-firebase-orm/lists"}