We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I think on the function get_file_detail must be checking file is None when class name ImageField or FileField.
If you can implement my code as below.
@register.simple_tag def get_file_detail(adminform, field): field_data = adminform.form.initial[field] field_name = type(field_data).__name__ try: if field_name == 'ImageFieldFile': if not bool(field_data): return {'type': 'image', 'width': 0, 'height': 0, 'url': '', 'size': 0, 'extension': ''} filename, file_extension = os.path.splitext(field_data.url) return {'type': 'image', 'width': field_data.width, 'height': field_data.height, 'url': field_data.url, 'size': field_data.size, 'extension': file_extension} if field_name == 'FieldFile': if not bool(field_data): return {'type': 'file', 'url': '', 'size': 0, 'extension': ''} filename, file_extension = os.path.splitext(field_data.url) return {'type': 'file', 'url': field_data.url, 'size': field_data.size, 'extension': file_extension} return field except IOError: pass
Thank You.
The text was updated successfully, but these errors were encountered:
Friday, 08 March 2019.
2cecdfa
1. Fix issue sainipray#5
No branches or pull requests
I think on the function get_file_detail must be checking file is None when class name ImageField or FileField.
If you can implement my code as below.
Thank You.
The text was updated successfully, but these errors were encountered: