Commit 09197ff1debe336d0fc980a4d062c1f2511c40a7

Authored by ailsoncgt
1 parent 64d3246d

URL Email backend #213

Showing 2 changed files with 18 additions and 0 deletions   Show diff stats
app/urls.py
... ... @@ -4,4 +4,5 @@ from . import views
4 4  
5 5 urlpatterns = [
6 6 url(r'^$', views.AppIndex.as_view(), name='index'),
  7 + url(r'^settings$', views.AmadeusSettings.as_view(), name='settings'),
7 8 ]
... ...
app/views.py
1 1 from django.shortcuts import render
2 2 from django.views.generic import ListView
  3 +from django.views import View
  4 +from rolepermissions.mixins import HasRoleMixin
3 5 from django.contrib.auth.mixins import LoginRequiredMixin
4 6 from django.core.urlresolvers import reverse_lazy
5 7 from core.mixins import LogMixin, NotificationMixin
6 8 from core.models import Notification, Action, Resource, Action_Resource
7 9 from users.models import User
  10 +from .models import EmailBackend
  11 +from .forms import EmailBackendForm
8 12 from courses.models import Course
9 13  
10 14 class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
... ... @@ -42,4 +46,17 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
42 46  
43 47 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs)
44 48  
  49 +class AmadeusSettings(LoginRequiredMixin, HasRoleMixin, View):
  50 + allowed_roles = ['system_admin']
  51 + login_url = reverse_lazy("core:home")
  52 + redirect_field_name = 'next'
  53 + model = EmailBackend
  54 + template_name = 'admin_settings.html'
  55 + form_class = EmailBackendForm
  56 + success_url = reverse_lazy('app:settings')
  57 +
  58 + def get(self, request):
  59 + return render(request, self.template_name, )
  60 +
  61 +
45 62  
... ...