def validate(self, data): """Only allow known keys, and convert -1 or empty strings to None""" validate_keys(self) data = {key: nonify(value) for key, value in data.items()} return data
def validate_hinfo(self, value): value = nonify(value) if value is not None: value = HinfoPreset.objects.get(pk=value) return value