Proper model defination in django for a widget manager
<p>I have a model called <code>widgetManager</code> and 2 widget models called <code>emailWidget</code> and <code>TextWidget</code>. Now a single instance of widgetManager can have multiple instances of emailWidget and TextWidget. How can this be achieved with the following in mind</p>

<ol>
<li>Till now i only have two but there can be more in future</li>
<li>The order of widget is very important</li>
</ol>

<p>I have tried with adding two many-many relations in widgetManager but that seems impractical and not the best way to go around because if first condition.</p>

<p>What i have in mind is maybe i can somehow make a base widget class and extend all the widgets from that class but i am not sure about that. Would be super helpful if someone can point me in the right direction. Thanks in advance. </p>

<p>If I understood your description correctly, you want a relationship where there can be many emailWidget or TextWidget for one instance of widgetManager. </p>

<p>What you can do in this case is add a ForeignKey field for widgetManager to emailWidget and TextWidget. This way, you can have many instances of the widgets while they refer to the same manager.</p>

<p>I think you may have confused inheritance with model relationships when you said you want to extend widgets from a base class. Perhaps I'm wrong? </p>

<p>Not sure what you mean't about order of the widget being important either..</p>

python django django-models