leplatrem/django-sizefield

Obtaining the raw value

sposs opened this issue · 3 comments

sposs commented

Hi,
I'm writing a small storage manager and I need to keep track of the disk usage. I can't access the file's raw size as stored in the DB because the to_python returns a 'parse_size' version of the size. Is there a way to still access the value? I'd like to increment and decrement my disk usage statistics...

sposs commented

Strange: the type is not right... Let's say I have a File with a 'size' declared at FileSizeField, a Disk object and a FileReplica object linking the 2, doing filereplica.db_file.size yields a unicode value of the size, not the integer value. Does that make sense?

I haven't played with Django for a while... Maybe have a look at the big integer field code in Django to see if there's any method that suits you...
Your use case seems totally consistent, there should be a way!
Don't hesitate to inspect the code here too, it's very short!
Good luck!

sposs commented

Ok ca marche ;)