how to validate empty field value in django 'import_export' at db level

17 views
Skip to first unread message

Shailesh Yadav

unread,
Jan 3, 2021, 8:24:44 PM1/3/21
to Django users
Hello everyone I have created one webpage where I am using Django 'import_export' Resource for .xlsfile upload. I am having below fields name in the .xls file as shown below image.

shift.png

Now here id is my primary key and upload functionality is working fine. Now I want that when the user is uploading details AConnectID should be checked/validated and if it is blank then the process should stop.

I have tried using null=False and validator but it is working at the form level.

AConnectID = models.CharField(max_length=100, null=False,validators= [validators.MinLengthValidator(3)])


Any help on this how-to validates it?.

resource.py

class CTAResource(resources.ModelResource):

 class meta: Model=CTA

Reply all
Reply to author
Forward
0 new messages