Answer the question
In order to leave comments, you need to log in
What is the correct way to search through Django models?
Good afternoon, dear residents!)
How to organize a search by models in a view:
class Group(models.Model):
name = models.CharField(u'Название', max_length=255)
def __unicode__(self):
return self.name
class Direction(models.Model):
...
group = models.ForeignKey(Group )
class items(models.Model):
code = models.CharField(verbose_name=u'Код', max_length=10)
name = models.CharField(u'Название', max_length=255)
direction = models.ForeignKey(Direction)
color = models.ManyToManyField(ColorObjects)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question