Html5 input types for metadata
I propose a feature where input types for Metadata forms would be html5 type aware based on its validator.
In class MetadataType(models.Model): I would add a function get_widget_for(self, document_type): where it would return the html5 widget: date, time, datetime, or text as default (https://docs.djangoproject.com/en/1.10/ref/forms/widgets/#built-in-widgets). This function would then be used in DocumentMetadataForm.init()
self.fields['value'].widget = self.metadata_type.get_widget_for(
document_type=self.document_type
)
It would be nice to also add more validators for other types in mayan/apps/metadata/validators.py, like Number, Email and others available in django for html5. Something along the lines:
class IntegerValidator(MetadataValidator):
def execute(self, input_data):
return int(input_data)
I would do it if accepted.