diff --git a/pgmanage/app/converters.py b/pgmanage/app/converters.py new file mode 100644 index 000000000..c8d84caaa --- /dev/null +++ b/pgmanage/app/converters.py @@ -0,0 +1,8 @@ +class SignedIntConverter: + regex = '-?\d+' + + def to_python(self, value): + return int(value) + + def to_url(self, value): + return '%d' % value \ No newline at end of file diff --git a/pgmanage/app/urls.py b/pgmanage/app/urls.py index 9abc8231f..ca3b93575 100644 --- a/pgmanage/app/urls.py +++ b/pgmanage/app/urls.py @@ -1,8 +1,10 @@ -from django.urls import include, path -from . import views +from django.urls import include, path, register_converter +from . import views, converters from django.conf import settings from django.conf.urls.static import static +register_converter(converters.SignedIntConverter, 'signedint') + base_urlpatterns = [ # path('social-auth/', include('social_django.urls', namespace="social")), @@ -292,8 +294,8 @@ path("monitoring-widgets/list", views.monitoring_dashboard.monitoring_widgets_list, name="monitoring-widgets-list"), path("monitoring-widgets/test", views.monitoring_dashboard.test_monitoring_widget, name="test-monitoring-widget"), path("monitoring-widgets/create", views.monitoring_dashboard.create_dashboard_monitoring_widget, name="create-dashboard-widget"), - path("monitoring-widgets/", views.monitoring_dashboard.widget_detail, name="dashboard-widget-detail"), - path("monitoring-widgets//template", views.monitoring_dashboard.widget_template, name="widget-template"), + path("monitoring-widgets/", views.monitoring_dashboard.widget_detail, name="dashboard-widget-detail"), + path("monitoring-widgets//template", views.monitoring_dashboard.widget_template, name="widget-template"), path("monitoring-widgets//refresh", views.monitoring_dashboard.refresh_monitoring_widget, name="refresh-monitoring-widget"), path("monitoring-widgets/user-created", views.monitoring_dashboard.create_widget, name="create-custom-widget"), path("monitoring-widgets/user-created/", views.monitoring_dashboard.user_created_widget_detail, name="widget-detail"),