Skip to content

Conversation

@abderraxim
Copy link

…ame_id as local id would mess up the related data on other models if database repopulation

…ame_id as local id would mess up the related data on other models if database repopulation
@jpic
Copy link
Member

jpic commented Jun 8, 2024 via email

@abderraxim
Copy link
Author

Yes indeed ,i will do that later

@jpic
Copy link
Member

jpic commented Jun 9, 2024 via email

@abderraxim
Copy link
Author

pardon me but i don't get the idea, if we're just switching to another key column , i'm not replacing the id key generated, but just defining the column to rely on

@jpic
Copy link
Member

jpic commented Jun 10, 2024 via email

@abderraxim
Copy link
Author

they should implement the migration or they can just explicitly specify the to_field and continue with the old model

    country = models.ForeignKey(
        Country, on_delete=models.DO_NOTHING, blank=True, null=True, to_field="id"
    )
    region = models.ForeignKey(
        Region, on_delete=models.DO_NOTHING, blank=True, null=True, to_field="id"
    )
    subregion = models.ForeignKey(
        SubRegion, on_delete=models.DO_NOTHING, blank=True, null=True, to_field="id"
    )
    city = models.ForeignKey(
        City, on_delete=models.DO_NOTHING, blank=True, null=True, to_field='id')

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

Successfully merging this pull request may close these issues.

3 participants