Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use django_export_import lib import django_smart_selects chainfileids? #327

Open
guistory opened this issue Feb 20, 2021 · 0 comments

Comments

@guistory
Copy link

first show my models:

> class District(models.Model):
>     code = models.CharField(verbose_name='乡镇编码',max_length=100,unique = True)
>     name = models.CharField(verbose_name='乡镇名称',max_length=100)
>     class Meta:
>         verbose_name = '乡镇信息'
>         verbose_name_plural = verbose_name
>     def __str__(self):
>         return self.name
> 
> class Villages(models.Model):
>     district = models.ForeignKey(District,verbose_name='所属乡镇',on_delete=models.PROTECT,blank=True,null=True)
>     code = models.CharField(verbose_name='行政村编码',max_length=100,unique = True)
>     name = models.CharField(verbose_name='行政村名称',max_length=100)
>     class Meta:
>         verbose_name = '行政村信息'
>         verbose_name_plural = verbose_name
>     def __str__(self):
>         return self.name
>         
> class baseinfo(models.Model):   
>     district = models.ForeignKey(District,verbose_name='乡/镇',blank=True,null=True,on_delete=models.PROTECT,)
>     villages = ChainedForeignKey(Villages,verbose_name='街/村',chained_field="district",chained_model_field="district",blank=True,null=True) 

when i use django_export_import lib import a baseinfos show me:
must be a instance of villages

help me , my english is very poor,hope you all understand my means.
thank you much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant