# An Unofficial Django and Firebase Library
This library aims to enable the uploading of media directly to Firebase from Django forms.
The FirebaseFileField provides four main automatic functionalities, which are:
* Saving the file to Firebase: If a file with the same name already exists, it will be renamed and saved. If you update the file, the previous one will be deleted.
* Moving the file: If you change the `upload_to` field and update a post of this model, the file will be automatically moved to the new address specified in `upload_to`.
* Checking if the file still exists: If you update a post and the file has been manually deleted from Firebase, the link in the post will be updated to `None`.
* Deleting the file: If you select to empty the field, the file will be automatically deleted.
How to use:
* First, you need to have the Firebase key file. It can be added to the root directory or another path of your choice and added to the settings, but it must be renamed to `Key.json`.
FIREBASEKEYPATH = "example/example"
* Second, you need to add the Firebase storage bucket to the settings.
STORAGEBUCKET = {'storageBucket': 'example.appspot.com'}
* Now, you just need to import and use it.
from firebasefilefield.import FirebaseFileField
class ExampleModel(models.Model):
Example = FirebaseFileField(upload_to='uploads/', null=True, blank=True)
If you don't want files to be automatically deleted along with the post, just set `auto_delete` to `False`.
from firebasefilefield.import FirebaseFileField
class ExampleModel(models.Model):
Example = FirebaseFileField(upload_to='uploads/', null=True, blank=True, auto_delete=False)
Raw data
{
"_id": null,
"home_page": null,
"name": "django-firebase-filefield",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "django, firebase, filefield, django firebase, django firebase filefield, firebase filefield",
"author": "Issei Momonge",
"author_email": "mggyggf@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/33/99/433ad5ee76e98a3945b54b9e7b26900ed3fd5dbbf3ab6f586c310d2ca377/django_firebase_filefield-2.0.0.tar.gz",
"platform": null,
"description": "# An Unofficial Django and Firebase Library\r\n\r\nThis library aims to enable the uploading of media directly to Firebase from Django forms.\r\n\r\nThe FirebaseFileField provides four main automatic functionalities, which are:\r\n* Saving the file to Firebase: If a file with the same name already exists, it will be renamed and saved. If you update the file, the previous one will be deleted.\r\n* Moving the file: If you change the `upload_to` field and update a post of this model, the file will be automatically moved to the new address specified in `upload_to`.\r\n* Checking if the file still exists: If you update a post and the file has been manually deleted from Firebase, the link in the post will be updated to `None`.\r\n* Deleting the file: If you select to empty the field, the file will be automatically deleted.\r\n\r\nHow to use:\r\n* First, you need to have the Firebase key file. It can be added to the root directory or another path of your choice and added to the settings, but it must be renamed to `Key.json`.\r\n\r\n FIREBASEKEYPATH = \"example/example\"\r\n\r\n* Second, you need to add the Firebase storage bucket to the settings.\r\n\r\n STORAGEBUCKET = {'storageBucket': 'example.appspot.com'}\r\n\r\n* Now, you just need to import and use it.\r\n\r\n from firebasefilefield.import FirebaseFileField\r\n \r\n class ExampleModel(models.Model):\r\n Example = FirebaseFileField(upload_to='uploads/', null=True, blank=True)\r\n\r\nIf you don't want files to be automatically deleted along with the post, just set `auto_delete` to `False`.\r\n\r\n from firebasefilefield.import FirebaseFileField\r\n \r\n class ExampleModel(models.Model):\r\n Example = FirebaseFileField(upload_to='uploads/', null=True, blank=True, auto_delete=False)\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "An Unofficial Django and Firebase Library",
"version": "2.0.0",
"project_urls": null,
"split_keywords": [
"django",
" firebase",
" filefield",
" django firebase",
" django firebase filefield",
" firebase filefield"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3399433ad5ee76e98a3945b54b9e7b26900ed3fd5dbbf3ab6f586c310d2ca377",
"md5": "fa00664d38864a5c3c631224672e8815",
"sha256": "7a69e237ec533a1f3dc9dac551d34345e05ffcc1f2ab2800b5c0c5f1763dbaf0"
},
"downloads": -1,
"filename": "django_firebase_filefield-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "fa00664d38864a5c3c631224672e8815",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4418,
"upload_time": "2024-04-13T20:45:15",
"upload_time_iso_8601": "2024-04-13T20:45:15.524643Z",
"url": "https://files.pythonhosted.org/packages/33/99/433ad5ee76e98a3945b54b9e7b26900ed3fd5dbbf3ab6f586c310d2ca377/django_firebase_filefield-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-13 20:45:15",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "django-firebase-filefield"
}