Skip to content

A model field to store a file size, whose edition and display shows units (KB, MB, ...)

Notifications You must be signed in to change notification settings

meteozond/django-sizefield

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

django-sizefield
----------------
A file size field, stored as BigInteger and rendered with units in Bytes (KB, MB, ...)


Examples
--------
With a model like ::


    class Data(models.Model):
        path = models.FilePathField()
        size = FileSizeField()

In templates ::

    {% load sizefieldtags %}
    
    {{ data.size|filesize }}
    
*will render 12.3KB (for example)*

The model form will have a TextInput, which renders the 
value with units, and accepts values with or without units.


About

A model field to store a file size, whose edition and display shows units (KB, MB, ...)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%