Re: sub-list not showing

2023-03-19 Thread nef
I just solve the issue by modifying the view.py like this def parentsDetails(request, pk): parentObj = Parents.objects.get(parent_id=pk) std = Student.objects.filter(std_parents = parentObj.parent_id) # std = parentObj.student_set.all() context = {'parentObj': parentObj, 'std':

Re: sub-list not showing

2023-03-17 Thread Sandip Bhattacharya
> On Mar 16, 2023, at 2:22 PM, nef wrote: > > class Student(models.Model): > #std_matricule = models.CharField(verbose_name='Student matricule', > max_length=6, null=False, unique=True, primary_key=True) > std_matricule = models.CharField(verbose_name='Matricule', unique=True, >

Re: sub-list not showing

2023-03-17 Thread Prosper Lekia
The easiest way to do this is to have a query of all students that has that parent. Add Something like this to your parent detail views, students = Students.objects.filter(parent__id = pk) context["students"] = students Your Template should be {% for student in students %}

Re: sub-list not showing

2023-03-16 Thread Brian Carey
A quick glance: In your temple for loop you have 'student_set' in the conditional and  'students_set' in the loop. That doesn't seem right. ⁣Get BlueMail for Android ​ On Mar 16, 2023, 9:01 PM, at 9:01 PM, nef wrote: >Hi Daniel, >Thanks for your feedback. >Please, is there anyone who can

Re: sub-list not showing

2023-03-16 Thread nef
Hi Daniel, Thanks for your feedback. Please, is there anyone who can help me on how to do it? Thank you On Thursday, 16 March 2023 at 22:01:53 UTC+1 Namanya Daniel wrote: > You need to achieve related fields to achieve the most of this… thank you > > On Thu, 16 Mar 2023 at 23:59, Namanya

Re: sub-list not showing

2023-03-16 Thread Namanya Daniel
You need to achieve related fields to achieve the most of this… thank you On Thu, 16 Mar 2023 at 23:59, Namanya Daniel wrote: > Hello… am using a phone to reply this but I would love to give a hint on > something. When you have a child, it’s means there’s a parent foreign key > in the child

Re: sub-list not showing

2023-03-16 Thread Namanya Daniel
Hello… am using a phone to reply this but I would love to give a hint on something. When you have a child, it’s means there’s a parent foreign key in the child model. You can use grouper to group child model results so that every is grouped together under a particular parent field. On Thu, 16 Mar

sub-list not showing

2023-03-16 Thread nef
Hi all, I am facing problem to display a sub-list. In my model, I ahave a Student and Parent models. A prent can have one or more students. I want to list all the student in the parent page, but it is not showing. Please see here my code. Models class Student(models.Model): #std_matricule =