django-fixture-magic icon indicating copy to clipboard operation
django-fixture-magic copied to clipboard

dump_object does not follow object relations

Open DataGreed opened this issue 5 years ago • 5 comments

Environment: Django 3.0.6

In my case the app does not follow relations when exporting data with dump_object

Simplified models:

class Member(BaseModel):

    email = models.EmailField(unique=True)
class Subscription(BaseModel):

    member = models.ForeignKey(Member, on_delete=models.CASCADE)

When I execute python manage.py dump_object members.member --query '{"pk__in": [1]} for a Member with several Subscriptions I only get the Member model dumped:

[
{
    "model": "accounts.member",
    "pk": 1,
    "fields": {
        "email": "[email protected]",
    }
}
]

DataGreed avatar Jul 07 '20 21:07 DataGreed

@DataGreed are those relations required properties for the model?

dopry avatar Nov 17 '22 14:11 dopry

@dopry sorry, no idea, it was two years ago, I don't even remember this case. But judging from the code, they are

DataGreed avatar Nov 17 '22 23:11 DataGreed

@DataGreed thanks. are you still using fixture magic at all?

dopry avatar Nov 18 '22 15:11 dopry

@DataGreed thanks. are you still using fixture magic at all?

not a t the moment, I've used it several times to generate test fixture, and I think I'll use it in the future for the same purppose :)

DataGreed avatar Nov 19 '22 00:11 DataGreed

we have the same use case. :)

dopry avatar Nov 28 '22 15:11 dopry