feat: add is_published flag to assignments
This commit is contained in:
+3
-2
@@ -36,7 +36,8 @@ def home(request):
|
||||
@user_passes_test(is_student, login_url='/login/')
|
||||
def dashboard(request):
|
||||
assignments = Assignment.objects.filter(
|
||||
Q(assign_to_all=True) | Q(assigned_students=request.user)
|
||||
Q(assign_to_all=True) | Q(assigned_students=request.user),
|
||||
is_published=True
|
||||
).distinct().order_by('-created_at')
|
||||
|
||||
# Check which ones the student has submitted
|
||||
@@ -52,7 +53,7 @@ def dashboard(request):
|
||||
@login_required
|
||||
@user_passes_test(is_student, login_url='/login/')
|
||||
def assignment_detail(request, pk):
|
||||
assignment = get_object_or_404(Assignment, pk=pk)
|
||||
assignment = get_object_or_404(Assignment, pk=pk, is_published=True)
|
||||
questions = assignment.questions.all()
|
||||
|
||||
# Try to get existing submission
|
||||
|
||||
Reference in New Issue
Block a user