我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.db.models.IPAddressField()。
def clean(self): strip_types = (models.CharField, models.TextField, models.URLField, models.EmailField, models.IPAddressField, models.GenericIPAddressField, models.SlugField) for field in self._meta.fields: # TODO: hardcode 'notes' here if not (field.name is 'notes') and isinstance(field, strip_types): value = getattr(self, field.name) if value: setattr(self, field.name, value.replace('\t', ' ').replace('\n', ' ').replace('\r', ' '))