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

fixtures #513

Open
alvarogf97 opened this issue Apr 18, 2022 · 1 comment
Open

fixtures #513

alvarogf97 opened this issue Apr 18, 2022 · 1 comment

Comments

@alvarogf97
Copy link

Hey there, I have been trying to create objects from a json file with the loaddata command without success. Is there anything special that I need write in the document?

[
  {
    "model": "animals.DogBreed",
    "pk": 1,
    "fields": {
      "polymorphic_ctype": 24,
      "name": { "en": "Affenpinscher", "es": "" },
      "weight": { "bounds": "[)", "lower": "3", "upper": "6" },
      "life_span": { "bounds": "[)", "lower": "10", "upper": "12" },
      "origins": [187, 118],
      "tags": [1, 2, 3, 4, 5, 6]
    }
  }
]

Thanks in advance

@johncronan
Copy link

Hi @alvarogf97,

I'm also working on serialization. Take a look at #517. When I repeat the steps from my issue, but without the manager code and model method for natural keys, I find that there's no problem. I can replace existing data, or I can change all the IDs from 1 to 2 and it creates a second record.

So that one definitely relates to natural keys, specifically. For your case, try to create a simple model that shows the issue you're having.

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

2 participants