Compare commits

..

2 commits

4 changed files with 161 additions and 5 deletions

View file

@ -1,7 +1,7 @@
from rest_framework import generics from rest_framework import generics
from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import IsAuthenticated
from rest_framework.pagination import PageNumberPagination from rest_framework.pagination import PageNumberPagination
from accounts.permissions import IsHead from accounts.permissions import IsHead, IsStaff
from rest_framework.pagination import PageNumberPagination from rest_framework.pagination import PageNumberPagination
from .serializers import ( from .serializers import (
DocumentRequestCreationSerializer, DocumentRequestCreationSerializer,
@ -45,13 +45,13 @@ class DocumentRequestListView(generics.ListAPIView):
class DocumentRequestFullListView(generics.ListAPIView): class DocumentRequestFullListView(generics.ListAPIView):
""" """
Returns document requests. Always returns the link to download the document. Returns document requests. Always returns the link to download the document.
Head is able to view all document requests here. Staff and clients have no access Head is able to view all document requests here. Clients have no access, only staff.
""" """
http_method_names = ["get"] http_method_names = ["get"]
serializer_class = DocumentRequestSerializer serializer_class = DocumentRequestSerializer
pagination_class = PageNumberPagination pagination_class = PageNumberPagination
permission_classes = [IsAuthenticated, IsHead] permission_classes = [IsAuthenticated, IsStaff]
queryset = DocumentRequest.objects.all() queryset = DocumentRequest.objects.all()

View file

@ -1,3 +1,11 @@
from django.contrib import admin from django.contrib import admin
from unfold.admin import ModelAdmin
# Register your models here. from .models import Questionnaire
@admin.register(Questionnaire)
class QuestionnaireAdmin(ModelAdmin):
model = Questionnaire
search_fields = ["id", "date_submitted"]
list_display = ["id", "date_submitted"]

View file

@ -0,0 +1,148 @@
# Generated by Django 5.1.3 on 2024-11-28 07:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("questionnaires", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="questionnaire",
name="sqd0_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd1_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd2_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd3_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd4_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd5_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd6_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd7_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
migrations.AlterField(
model_name="questionnaire",
name="sqd8_answer",
field=models.CharField(
choices=[
("1", "Strongly Disagree"),
("2", "Disagree"),
("3", "Neither Agree nor Disagree"),
("4", "Agree"),
("5", "Strongly Agree"),
("6", "N/A"),
],
max_length=16,
),
),
]

View file

@ -74,7 +74,7 @@ class Questionnaire(models.Model):
# SQD Questions # SQD Questions
SQD_CHOICES = ( SQD_CHOICES = (
("1", "Strongly disagree"), ("1", "Strongly Disagree"),
("2", "Disagree"), ("2", "Disagree"),
("3", "Neither Agree nor Disagree"), ("3", "Neither Agree nor Disagree"),
("4", "Agree"), ("4", "Agree"),