@staff_member_required()
def new_subject(request, dataset_id):
    try:
        dataset = Dataset.objects.get(pk=dataset_id)
    except Dataset.DoesNotExist:
        return Http404('The dataset does not exist')
    if (request.method == 'POST'):
        form = SubjectForm(request.POST)
        if form.is_valid():
            subject = form.save(commit=False)
            subject.dataset = dataset
            subject.save()
            messages.success(request, 'Subject added')
            return redirect('dataset_details', dataset.id)
    else:
        form = SubjectForm()
    return render(request, 'annotationweb/new_subject.html', {'dataset': dataset, 'form': form})
@staff_member_required()
def new_subject(request, dataset_id):
    try:
        dataset = Dataset.objects.get(pk=dataset_id)
    except Dataset.DoesNotExist:
        return Http404('The dataset does not exist')
    if (request.method == 'POST'):
        form = SubjectForm(request.POST)
        if form.is_valid():
            subject = form.save(commit=False)
            subject.dataset = dataset
            subject.save()
            messages.success(request, 'Subject added')
            return redirect('dataset_details', dataset.id)
    else:
        form = SubjectForm()
    return render(request, 'annotationweb/new_subject.html', {'dataset': dataset, 'form': form})