Skip to main content

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)

Release files for django-firebase-filefield 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-firebase-filefield 2.0.0
File Size Uploaded
django_firebase_filefield-2.0.0.tar.gz 4.4 kB Details

Release files / django_firebase_filefield-2.0.0.tar.gz

Download URL django_firebase_filefield-2.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7a69e237ec533a1f3dc9dac551d34345e05ffcc1f2ab2800b5c0c5f1763dbaf0
BLAKE2b-256 checksum
How to use checksums
3399433ad5ee76e98a3945b54b9e7b26900ed3fd5dbbf3ab6f586c310d2ca377
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

2.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page