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': std}
> 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,
> max_l
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 %}
{{student.std_matric
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 help
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 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 mode
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
7 matches
Mail list logo