On Apr 6, 7:26 pm, "jani.mono...@gmail.com" <jani.mono...@gmail.com> wrote: > > The generated model from inspectdb is only a best guess, but there's > > nothing to stop you editing it. If your field really is a foreign key, > > Not really a foreign key,both tables have a string field ID which is > the same, > and unique in one table. So it could be a foreign key except it is not > explicitly > set in MySQL (so not only in the inspectdb output, but in the original > tables as well)
I think you should still be able to define the Django field as a ForeignKey, as long as you set the 'to_field' attribute to the relevant field on the target model. It shouldn't matter that the database field doesn't have a foreign key constraint - these don't exist on MyISAM tables within MySQL, or in sqlite3, both of which Django supports. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.