ZerG
Полагаю описание ваших моделей и как вы строите запрос мы должны угадать?
Models.py
class Konkurs_result(models.Model):
konkurs = models.ForeignKey('Konkurs', on_delete=models.CASCADE, blank=True, null=True)
konkurs_j = models.ForeignKey('Konkurs_j', on_delete=models.SET_NULL, null=True, blank=True )
konkurs_k = models.ForeignKey('Konkurs_k', on_delete=models.SET_NULL, null=True, blank=True)
konkurs_tour = models.ForeignKey('Konkurs_tour', on_delete=models.SET_NULL, null=True, blank=True)
ocenka = models.CharField('Оценка', max_length=100)
dop_info = models.TextField('Дополнительная информация', null=True, blank=True)
class Konkurs_k(models.Model):
konkurs= models.ForeignKey('Konkurs', on_delete=models.CASCADE, blank=True, null=True)
konkursants = models.ForeignKey('Konkursants', on_delete=models.CASCADE)
class Konkursants(models.Model):
fio = models.CharField('ФИО', max_length=70)
doljn = models.CharField('Должность', max_length=100,null=True, blank=True)
otdel = models.TextField('Отдел', null=True, blank=True)
dop_info = models.TextField('Дополнительная информация', null=True, blank=True)
image=models.ImageField(verbose_name='Фото', upload_to='gallery/',blank=True, null=True)
date_reg = models.DateTimeField(auto_now_add=True)
Views.py
class konkurs_resultSelect(LoginRequiredMixin,generic.ListView):
model = Konkurs_result
template_name = 'main/form_konkurs_result.html'
context_object_name = 'konks_result'
paginate_by = 4
def get_queryset(self):
return Konkurs_result.objects.filter(konkurs_tour=self.kwargs['pk'],konkurs=self.kwargs['pk2']).select_related('konkurs','konkurs_k','konkurs_j','konkurs_tour')