(request)
| 90 | |
| 91 | @login_required |
| 92 | def index(request): |
| 93 | if request.method == "POST": |
| 94 | |
| 95 | form = ConfigurationForm(request.POST) |
| 96 | test_configuration = request.POST.get("test_configuration") |
| 97 | if form.is_valid() and test_configuration: |
| 98 | form.test_settings(request) |
| 99 | elif form.is_valid() and not test_configuration: |
| 100 | form.save_settings() |
| 101 | messages.success(request, "Notification settings applied successfully!") |
| 102 | else: |
| 103 | config_data = config.load() |
| 104 | |
| 105 | # notification_app_name initial value should be whatever is defined in the settings |
| 106 | settings = Setting.objects.first() |
| 107 | config_data['notification_app_name'] = config_data['notification_app_name'] or settings.app_name |
| 108 | form = ConfigurationForm(initial=config_data) |
| 109 | |
| 110 | return render(request, self.template_path('index.html'), {'form' : form, 'title' : 'Task Notification'}) |
| 111 | |
| 112 | return [ |
| 113 | MountPoint('$', index), |
nothing calls this directly
no test coverage detected