Commit c3cb2084 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

student's page now pulls from database, other important changes

parent 79894ac2
......@@ -8,40 +8,32 @@ GMU Advisor | Student's Name
<div class="row">
<div class="col-md-5">
<h3>Student's Name</h3>
<h3>{{ student.user.first_name }} {{ student.user.last_name }}</h3>
</div>
</div>
<h4><strong>My Trajectories</strong></h4>
<div class="row">
<div class="col-md-5">
<h4>Saved Trajectory Name</h4>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-primary">Edit</button>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-default">Private</button>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-danger">Delete</button>
</div>
</div>
<div class="row">
<div class="col-md-5">
<h4>Saved Trajectory Name</h4>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-primary">Edit</button>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-success">Public</button>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-danger">Delete</button>
</div>
</div>
{% for trajectory in topTrajectories %}
<div class="row">
<div class="col-md-5">
<h4>{{ trajectory.name }}</h4>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-primary">Edit</button>
</div>
<div class="col-md-1">
{% if trajectory.isPublic %}
<button type="button" class="btn btn-success">Public</button>
{% else %}
<button type="button" class="btn btn-default">Private</button>
{% endif %}
</div>
<div class="col-md-1">
<button type="button" class="btn btn-danger">Delete</button>
</div>
</div>
{% endfor %}
<!-- How does one edit the courses that they've already completed? -->
......
......@@ -97,7 +97,7 @@ class Trajectory(BaseModel):
name = models.CharField(max_length = 150)
# Takes courses
previousCourses = models.ManyToManyField('Course',)
previousCourses = models.ManyToManyField('Trajectory',)
isPublic = models.BooleanField()
......
......@@ -38,6 +38,11 @@ def nextCourses(coursesTaken, remainingReqCourses):
# how does one deal with "you have to take the coreq at the same time?"
def topTrajectories(trajectories):
topTrajectories = []
# trajectories take trajectories
# find the one on the top of the pile
return topTrajectories
# page render functions
......@@ -78,10 +83,15 @@ def course(request, slug):
#@login_required
def student(request, slug):
student = get_object_or_404(Student, student__username=username)
student = get_object_or_404(Student, user__username=username)
trajectories = Trajectory.objects.filter(student__user__username=username)
topTrajectories = topTrajectories(trajectories)
return render(request, 'student.html', {
'student' : student,
'topTrajectories' : topTrajectories,
},
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment