আমি একটি রেজাল্ট ম্যানেজমেন্ট সিস্টেম তৈরি করছি। এতে এভাবে কোর্সের সকল ফলাফল দেখাতে চাচ্ছি

Select Session --> Select Course --> Result (will be shown)

এখন সমস্যা হলো, আমি শেষ ধাপে কেবল ঐ সেশনে উদ্দিষ্ট কোর্সের শিক্ষার্থীদেরকে শো করতে পারছি না।

আমার কোডঃ

class Course(models.Model):
    cid = models.AutoField(primary_key=True)

class Student(models.Model):
    sroll = models.IntegerField()

class Teacher(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)

class Session(models.Model):
    sesid = models.IntegerField(primary_key=True,verbose_name= ('Session'))

class Registration(models.Model):
    session = models.ForeignKey(Session, on_delete=models.CASCADE)
    course = models.ForeignKey(Course, on_delete=models.CASCADE)

class Assignation(models.Model):
    reg = models.ForeignKey(Registration, on_delete=models.CASCADE, null=True)
    teacher = models.ForeignKey(Teacher, on_delete=models.CASCADE, null=True)

class Result(models.Model):
    asign = models.ForeignKey(Assignation, on_delete=models.CASCADE, null=True)
    student = models.ForeignKey(Student, on_delete=models.CASCADE, null=True)
    ct1 = models.FloatField(null=True, blank=True)

ভিউস পাই

@method_decorator(login_required, name='dispatch')
class SelectSession(ListView):
    template_name = 'Dashboard/selectsession.html'
    model = Session
    fields = ['sesid']

    def get_queryset(self):
        return Session.objects.all()

@method_decorator(login_required, name='dispatch')
class SelectCourse(ListView):
    template_name = 'Dashboard/selectcourse.html'
    model = Course, Registration
    fields = ['all']

    def get_queryset(self):
        course = Registration.objects.filter(session_id=self.kwargs['pk'])
        return course

@method_decorator(login_required, name='dispatch')
class BatchResult(ListView):
    template_name = 'Dashboard/batchResult.html'
    model = Result,Student,Registration,Assignation
    fields = ['all']

    def get_queryset(self):
        result=Result.objects.filter(???=self.kwargs['pk'])
        return result

asked 22 Sep, 06:01

petaibrahim's gravatar image

petaibrahim
111

edited 22 Sep, 14:31

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
63118

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×17

question asked: 22 Sep, 06:01

question was seen: 70 times

last updated: 22 Sep, 14:31