Skip to content

Commit

Permalink
Implement linking in information display pages (#35)
Browse files Browse the repository at this point in the history
* Update required packages and README.md

* Implement linking from institute to level table

Implement institute filter for level table

* Implement linking from level to programme table

Implement level filter for programme table

* Implement linking from programme to discipline table

Implement programme filter for discipline table

* Implement linking from discipline to course table

Implement discipline filter for course table

* Implement linking from course to module table

Implement course filter for module table

* Implement linking from module to unit table

Implement module filter for unit table
  • Loading branch information
SurajDadral authored Jan 2, 2020
1 parent d990927 commit c0c59d6
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 14 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Requirements
1. python-mysqldb
1. django 3.0
1. libldap2-dev
1. libmysqlclient-dev
```

#### Installation
Expand All @@ -34,7 +35,7 @@ chmod +x setup.sh
Installation of Requirements

```bash
sudo apt install apache2 mysql-server python python3-pip python-mysqldb libldap2-dev
sudo apt install apache2 mysql-server python python3-pip python-mysqldb libldap2-dev libmysqlclient-dev
sudo python3 -m pip install -r requirements.txt
```

Expand Down Expand Up @@ -62,7 +63,7 @@ DATABASES = {
```bash
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver 127.0.0.1:8000
python3 manage.py runserver 127.0.0.1:8090
```
1. Open "http://127.0.0.1:8090" in your browser.

Expand Down
49 changes: 48 additions & 1 deletion course/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,87 @@ class Meta:


class LevelFilter(django_filters.FilterSet):
institute_id = django_filters.ModelChoiceFilter(
field_name="institute",
lookup_expr="exact",
empty_label="Select Institute",
queryset=Institute.objects.all(),
)

class Meta:
model = Level
fields = {"level_name": ["icontains"]}


class ProgrammeFilter(django_filters.FilterSet):
level_id = django_filters.ModelChoiceFilter(
field_name="level",
lookup_expr="exact",
empty_label="Select Level",
queryset=Level.objects.all(),
)

class Meta:
model = Programme
fields = {"programme_code": ["exact"], "programme_name": ["icontains"]}


class DisciplineFilter(django_filters.FilterSet):
department_code = django_filters.ModelChoiceFilter(
field_name="department",
lookup_expr="exact",
empty_label="Select Department",
queryset=Department.objects.all(),
)
programme_code = django_filters.ModelChoiceFilter(
field_name="programme",
lookup_expr="exact",
empty_label="Select Programme",
queryset=Programme.objects.all(),
)

class Meta:
model = Discipline
fields = {
"discipline_code": ["exact"],
"discipline_name": ["icontains"],
"department__department_name": ["icontains"],
}


class CourseFilter(django_filters.FilterSet):
discipline_code = django_filters.ModelChoiceFilter(
field_name="discipline",
lookup_expr="exact",
empty_label="Select Discipline",
queryset=Discipline.objects.all(),
)

class Meta:
model = Course
fields = {"course_id": ["exact"], "course_title": ["icontains"]}


class ModuleFilter(django_filters.FilterSet):
course_id = django_filters.ModelChoiceFilter(
field_name="course",
lookup_expr="exact",
empty_label="Select Course",
queryset=Course.objects.all(),
)

class Meta:
model = Module
fields = {"module_title": ["icontains"]}


class UnitFilter(django_filters.FilterSet):
module_id = django_filters.ModelChoiceFilter(
field_name="module",
lookup_expr="exact",
empty_label="Select Module",
queryset=Module.objects.all(),
)

class Meta:
model = Unit
fields = {"unit_name": ["icontains"]}
Loading

0 comments on commit c0c59d6

Please sign in to comment.