Dobrý den, mám tady takovýhle kód: <br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">from django.db import models<br>from django.contrib.auth import models as aModels<br>
<br>class teacher(aModels.User):<br> telefon = models.IntegerField()<br> <br>class Trida(models.Model):<br> name = models.CharField(max_length = 15)<br> classTeacher = models.OneToOneField(teacher)<br></blockquote>
<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote"><div> students = models.ManyToManyField(student)<br></div></blockquote><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
<br>class student(aModels.User):<br> Tridy = models.ManyToManyField(Trida)<br></blockquote><div><br> problém je že jedno je definované druhým, nevíte co s tím? <br><br>Zkoušel jsem i následovný kód: <br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
from django.db import models<br>from django.contrib.auth import models as aModels<br><br>class teacher(aModels.User):<br> telefon = models.IntegerField()<br> <br>class Trida(models.Model):<br> name = models.CharField(max_length = 15)<br>
classTeacher = models.OneToOneField(teacher)<br> <br>class student(aModels.User):<br> Tridy = models.ManyToManyField(Trida)<br><br><br>Trida.students = models.ManyToManyField(student)<br></blockquote><div> <br>Ale django nevytvoří patřičný model, nevíte o nějaké metodě jak to řešit?<br>
</div></div>