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

repeated sintax on proto appears a string instead of empty array after migration #34

Open
davidgacc opened this issue Jan 4, 2022 · 2 comments

Comments

@davidgacc
Copy link

davidgacc commented Jan 4, 2022

i have a proto :

enumx{
   VALUE1 = 0;
   VALUE2 = 0;
}

proto_test{
  repeated enumx variable_test;
}

django model

class modelx(ProtoBufMixin, Model):
  pb_model = proto_test_pb2.model
  pb_2_dj_fields = "__all__"

when i do a migration , I expected as a result to created an empty array on variable_test, however after the migration I got a empty string. How can I solve this problem? .

As you can see the default on migration shows as empty array, however I got a empty string


class Migration(migrations.Migration):

    dependencies = [
        ('bla', '0054_xxxx'),
    ]

    operations = [
        migrations.AddField(
            model_name='modeltext',
            name='variable',
            field=pb_model.fields.ArrayField(default=[]),
            preserve_default=False,
        ),
    ]

result:

{'_state': <django.db.models.base.ModelState at 0x7f94aab7f090>,
 'id': 34fssd35,
 'created_time': datetime.datetime(2022, 1, 3, 14, 1, 15, 528382),
 'updated_time': datetime.datetime(2022, 1, 3, 21, 22, 36, 303208),
 'description': 'automatically created with default configurations',
 'company_id': 232,
 'validity_start_time': datetime.datetime(2022, 1, 3, 0, 0),
 'billing_mode': 1,
 'billing_cycle': 4,
 'fiscal_document_files_to_exclude': ""}
@myyang
Copy link
Owner

myyang commented Feb 25, 2022

I'm not sure about which field in result, is it 'fiscal_document_files_to_exclude' ?

@davidgacc
Copy link
Author

davidgacc commented Feb 26, 2022

´fiscal_document_files_to_exclude´ is an empty array defined in proto.

Repository owner deleted a comment Feb 20, 2024
Repository owner deleted a comment Feb 26, 2024
Repository owner deleted a comment from parallaxlogicdevelopment Mar 19, 2024
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