I'm using Django-import-export on django admin. I want to export the data that are not related. (Are related but it's weird..) Example:
models.py
class A(models.Model):
name = models.CharField(default=False)
size= models.CharField(default=True)
class B(models.Model):
relation = models.ForeignKey(A,on_delete=models.CASCADE)
title = models.CharField(default=False)
category = models.CharField(default=False)
I want something like this:
admin.py
class export(resources.ModelResource):
name = Field(column_name='something',attribute='name')
category =Field(column_name='something_else',attribute='category')
class Meta:
model = A
fields = ('name','category')
class A_Admin(ExportActionMixin,admin.ModelAdmin):
resource_class=export
....
....
I need to get the data from model B that have a relation with A but A dont have relation with B...
Bs, so how would you "merge" the collection of values of theBs?