diff --git a/core/core/urls.py b/core/core/urls.py index b0161bb..ba3e975 100644 --- a/core/core/urls.py +++ b/core/core/urls.py @@ -31,5 +31,6 @@ urlpatterns = [ path('api/2/', include('mail.api_v2')), path('api/2/', include('notify_sessions.api_v2')), path('api/2/', include('authentication.api_v2')), + path('api/2/', include('notifications.api_v2')), path('api/', get_info), ] diff --git a/core/notifications/admin.py b/core/notifications/admin.py new file mode 100644 index 0000000..69620a9 --- /dev/null +++ b/core/notifications/admin.py @@ -0,0 +1,15 @@ +from django.contrib import admin + +from notifications.models import MessageTemplate, UserNotificationChannel + + +class MessageTemplateAdmin(admin.ModelAdmin): + pass + + +class UserNotificationChannelAdmin(admin.ModelAdmin): + pass + + +admin.site.register(MessageTemplate, MessageTemplateAdmin) +admin.site.register(UserNotificationChannel, UserNotificationChannelAdmin) diff --git a/core/notifications/api_v2.py b/core/notifications/api_v2.py new file mode 100644 index 0000000..c06673b --- /dev/null +++ b/core/notifications/api_v2.py @@ -0,0 +1,20 @@ +from rest_framework import routers, viewsets +from notifications.models import MessageTemplate +from rest_framework import serializers + + +class MessageTemplateSerializer(serializers.ModelSerializer): + class Meta: + model = MessageTemplate + fields = '__all__' + + +class MessageTemplateViewSet(viewsets.ModelViewSet): + serializer_class = MessageTemplateSerializer + queryset = MessageTemplate.objects.all() + + +router = routers.SimpleRouter() +router.register(r'message_templates', MessageTemplateViewSet) + +urlpatterns = ([] + router.urls) diff --git a/core/notifications/defauls.py b/core/notifications/defaults.py similarity index 100% rename from core/notifications/defauls.py rename to core/notifications/defaults.py diff --git a/core/notifications/migrations/0001_initial.py b/core/notifications/migrations/0001_initial.py index dcfc4d2..7580f03 100644 --- a/core/notifications/migrations/0001_initial.py +++ b/core/notifications/migrations/0001_initial.py @@ -4,7 +4,7 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion -from notifications.defauls import auto_reply_body, new_issue_notification, reply_issue_notification +from notifications.defaults import auto_reply_body, new_issue_notification, reply_issue_notification from notifications.models import MessageTemplate