Does it behave the way you're expecting it to behave if you declare field as models.CharField(max_length=4, primary_key=True)?
On Saturday, 26 March 2022 at 15:45:39 UTC+2 sandeep...@gmail.com wrote: > class View(models.Model): > field = models.CharField(max_length=4) > class Meta: > managed=False > db_table = 'view' #database view > > class Child(models.Model): > view = models.ForeignKey(View, on_delete=models.CASCADE, > to_field='field', db_constraint=False) > > makemigrations on above will have the *view* field of type integer while > it should be varcher(4) > > This is my first post to the forum. Please inform if something is amiss. > > Thank You > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a08d95ee-7707-4ef6-bf7a-df77b0b81726n%40googlegroups.com.