Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>not sure if I understand your question correctly, but the way multi-table model inheritance works ist that there will be an implicit one-to-one field in the parent and child models. So both User and Group would use an ID field of AccessEntity if AccessEntity has such a field. </p> <p>If you create AccessEntity such that it has a field <code>ID</code> you can assign to it when you write a forward (data)-migration. That way you can make sure that the AccessEntity gets the right ID.</p> <p>If have written a longer <a href="http://www.paulkoerbitz.de/post/27/refactoring-django-models-with-table-inheritance-using-django-south/" rel="nofollow noreferrer">multi-table inheritance tutorial</a> and it looks like you are trying to do something similar. </p> <p>And furthermore the answer to <a href="https://stackoverflow.com/questions/1600129/using-south-to-refactor-a-django-model-with-inheritence">this question</a> could also be helpful (note that some things in the original answer does will not work in new versions of django / south, see my tutorial / the answer at the bottom for changes).</p> <p>What might be a problem in your case is that if you already have data in both User and Groups and the id field is auto-generated, <code>IDs</code> likely not be distinct, e.g. you are likely going to have both a User and a Group with <code>ID==1</code>. This could be a problem if you want to query based on those <code>IDs</code> and of course <code>ID</code> could not be a primary key for <code>AccessEntity</code> then.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload