Skip to content

Commit

Permalink
add pagination tabular inlines (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
danangmassandy authored Oct 30, 2024
1 parent c725c85 commit 9af6cc5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions deployment/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ django-revproxy==0.12.0

# fiona
fiona==1.10.1

# django admin inline paginator
django-admin-inline-paginator==0.4.0
3 changes: 2 additions & 1 deletion django_project/core/settings/contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
'django_celery_beat',
'django_celery_results',
'drf_yasg',
'rest_framework_tracking'
'rest_framework_tracking',
'django_admin_inline_paginator'
)

WEBPACK_LOADER = {
Expand Down
4 changes: 3 additions & 1 deletion django_project/gap/admin/crop_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
from django.contrib import admin, messages
from django.utils.html import format_html
from django_admin_inline_paginator.admin import TabularInlinePaginated

from core.admin import AbstractDefinitionAdmin
from gap.models import (
Expand All @@ -24,10 +25,11 @@ class CropAdmin(AbstractDefinitionAdmin):
pass


class FarmShortTermForecastDataInline(admin.TabularInline):
class FarmShortTermForecastDataInline(TabularInlinePaginated):
"""FarmShortTermForecastData inline."""

model = FarmShortTermForecastData
per_page = 20
extra = 0


Expand Down
4 changes: 3 additions & 1 deletion django_project/gap/admin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil

from django.contrib import admin, messages
from django_admin_inline_paginator.admin import TabularInlinePaginated

from core.admin import AbstractDefinitionAdmin
from gap.models import (
Expand Down Expand Up @@ -98,10 +99,11 @@ def has_add_permission(self, request, obj=None):
return False


class IngestorSessionProgressInline(admin.TabularInline):
class IngestorSessionProgressInline(TabularInlinePaginated):
"""IngestorSessionProgress inline."""

model = IngestorSessionProgress
per_page = 20
extra = 0


Expand Down

0 comments on commit 9af6cc5

Please sign in to comment.