code: def formfield_for_dbfield(self, db_field, **kwargs):
          ''' Offer grading choices from the assignment definition as potential form
              field values for 'grading'.
              When no object is given in the form, the this is a new manual submission
          '''
          if db_field.name == "grading":
              submurl = kwargs['request'].path
              try:
                  # Does not work on new submission action by admin or with a change of URLs. The former is expectable.
                  submid = [int(s) for s in submurl.split('/') if s.isdigit()][0]
                  kwargs["queryset"] = Submission.objects.get(
                      pk=submid).assignment.gradingScheme.gradings
              except:
                  kwargs["queryset"] = Grading.objects.none()
          return super(SubmissionAdmin, self).formfield_for_dbfield(db_field, **kwargsf formfield_for_dbfield(self, db_field, **kwargs):
          ''' Offer grading choices from the assignment definition as potential form
              field values for 'grading'.
              When no object is given in the form, the this is a new manual submission
          '''
          if db_field.name == "grading":
              submurl = kwargs['request'].path
              try:
                  # Does not work on new submission action by admin or with a change of URLs. The former is expectable.
                  submid = [int(s) for s in submurl.split('/') if s.isdigit()][0]
                  kwargs["queryset"] = Submission.objects.get(
                      pk=submid).assignment.gradingScheme.gradings
              except:
                  kwargs["queryset"] = Grading.objects.none()
          return super(SubmissionAdmin, self).formfield_for_dbfield(db_field, **kwargs)
docs: Offer grading choices from the assignment definition as potential form
              field values for 'grading'.
              When no object is given in the form, the this is a new manual submission