Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class YourModelAdminForm(forms.ModelForm):
- def clean_your_field(self):
- if format_is_not_valid:
- raise forms.ValidationError('Format is not valid')
- class YourModelAdmin(admin.ModelAdmin):
- form = YourModelAdminForm
- admin.site.register(YourModel, YourModelAdmin)
- class YourModel(models.Model):
- your_field = models.FileField(validators=[your_validator])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement