Skip to content

Commit

Permalink
Merge pull request #43 from BilalZaib/StudentViewChanges
Browse files Browse the repository at this point in the history
Student view list_display changes
  • Loading branch information
recluze authored Sep 7, 2017
2 parents 750da8e + c70ae15 commit 5e8b7ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AutoGrade/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def get_queryset(self, request):
return qs
return qs.filter(courses__instructor__user=request.user)

list_display = ('student_username', 'student_firstname', 'student_lastname', 'student_email')

class SubmissionInline(admin.TabularInline):
model = Submission
fieldsets = (
Expand Down
16 changes: 16 additions & 0 deletions AutoGrade/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ class Student(models.Model):
def get_roll_number(self):
return self.user.email.split("@")[0]

def student_username(self):
return self.user.username
student_username.short_description = 'Username'

def student_firstname(self):
return self.user.first_name
student_firstname.short_description = 'First Name'

def student_lastname(self):
return self.user.last_name
student_lastname.short_description = 'Last Name'

def student_email(self):
return self.user.email
student_email.short_description = 'Email'


class Assignment(models.Model):
course = models.ForeignKey(Course, on_delete=models.CASCADE, null=False, default=None)
Expand Down

0 comments on commit 5e8b7ee

Please sign in to comment.