My problem is like so,
I am using django-tables2 and I want to list some people on my page but these people should go through some queries. These queries will change according to information from other models.if the query is ok, this person will be in my table.
# My models
class AgeGroup(models.Model):
age_group = models.CharField(choices=age_choices, max_length=5)
class SolvedExam(models.Model):
age = models.ForeignKey(AgeGroup, on_delete=models.CASCADE, related_name='solved_exam_age_group')
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='solved_exam')
class Person(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='person')
age = models.ForeignKey(AgeGroup, on_delete=models.CASCADE, related_name='person_age_group')
*
*
*
class Exam(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='person')
age = models.ForeignKey(AgeGroup, on_delete=models.CASCADE, related_name='exam_age_group')
*
*
*
# my view
class PersonList(SingleTableMixin, FilterView):
table_class = PersonTable
model = Person
queryset = Person.objects.all()
paginate_by = 10
template_name = 'person/person-list.html'
filterset_class = PersonFilter
def get_queryset(self):
super(Ogrenciler, self).get_queryset()
return Person.objects.filter( **some query** )
raise Http404
I want to list the students if there are exams which is not finished in the person's age group.
Thank you very much!
Where is the information about the examns, and the examns that where not passed? Typically I would expect an fields like Exman_id, class name, boolean passed etc.