C
C
Cyrus2015-12-30 10:30:30
Django
Cyrus, 2015-12-30 10:30:30

How to display a couple of classes (class) from the model into one list?

Doby day, there are a couple of classes in the model, they look something like this

class TVlist(models.Model):
   uuid = models.CharField()
   ...
   ...

class IntList(models.Model):
   uuid = models.CharField()
   ...
   ...

And I want to display them in one list on the page, how can I organize this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey K, 2015-12-30
@Novakuz

import itertools
objects = itertools.chain(TVlist.objects.all(), IntList.objects.all())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question