[Fixed]-Trying to settle on a database model for words and translations?


Isn’t what you have more of the structure where you have a Word table, a Language table, and then your translation table is a through table connecting the Word table with itself. Then you can put all that additional information on the through table, and query it as a connection between two Word objects

If you don’t know what a through table is, the documentation for how to use it can be found here: https://docs.djangoproject.com/en/1.8/topics/db/models/#extra-fields-on-many-to-many-relationships


Why not use your second example with a related_name?

class Translation()
        language1 = ForeignKey(word, related_name = 'masculine')
        language2 = ForeignKey(word, related_name = 'feminine')

Leave a comment