[Python] django_get_or_create doesn't let me create instances

Discussão em 'Python' iniciado por Stack, Junho 2, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using ModelFactory through SubFactory and there was django_get_or_create Meta field with ('code') inside. I put my 2 new added to model fields to this field django_get_or_create and it literally stopped making countries with 'RU' code and didint fill my array? There's an issue with this field or im doing something really wrong?

    I did try to search for similar problem but didn't find anything [

    class ModelFactory(DjangoModelFactory):
    code = "RU"
    predefined_amounts_one_time = [500, 1000, 3000]
    predefined_amounts_recurring = [500, 1000, 3000]

    class Meta:
    model = Model
    django_get_or_create = ("predefined_amounts_one_time", "predefined_amounts_recurring", "code")]


    1

    this is what i get multiple times in tests when i try to print those fields: Turkey []

    Turkey is an aliase to TR

    Continue reading...

Compartilhe esta Página