# Path: mineid/apps/mixins.py
# class AppViewMixin(LoginRequiredMixin):
#     pass
# 
# class AppUserObjectsMixin(AppUserObjectMixin, UserObjectsMixin):
#     pass
# 
# class AppUserObjectMixin(object):
#     model = Client
# 
# class AppFormMixin(FormValidMessageMixin, BaseAppFormMixin):
#     pass
# 
# class AppDeleteMixin(FormValidMessageMixin, AppEditObjectMixin):
#     def delete(self, *args, **kwargs):
#         self.messages.success(self.get_form_valid_message(),
#                               fail_silently=True)
#         return super(AppDeleteMixin, self).delete(*args, **kwargs)


from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView, CreateView, UpdateView, \
    DeleteView, DetailView
from .mixins import AppViewMixin, AppUserObjectsMixin, AppUserObjectMixin, \
    AppFormMixin, AppDeleteMixin



class AppList(AppViewMixin, AppUserObjectsMixin, ListView):
    template_name = 'mineid/apps/list.html'


class AppCreate(AppViewMixin, AppUserObjectMixin, AppFormMixin, CreateView):
    template_name = 'mineid/apps/create.html'
    form_valid_message = _('Application created')

    def get_initial(self):
        initial = super(AppCreate, self).get_initial()
        initial['url'] = 'http://'
        initial['redirect_uri'] = 'http://'
        return initial



# Path: mineid/apps/mixins.py
# class AppViewMixin(LoginRequiredMixin):
#     pass
# 
# class AppUserObjectsMixin(AppUserObjectMixin, UserObjectsMixin):
#     pass
# 
# class AppUserObjectMixin(object):
#     model = Client
# 
# class AppFormMixin(FormValidMessageMixin, BaseAppFormMixin):
#     pass
# 
# class AppDeleteMixin(FormValidMessageMixin, AppEditObjectMixin):
#     def delete(self, *args, **kwargs):
#         self.messages.success(self.get_form_valid_message(),
#                               fail_silently=True)
#         return super(AppDeleteMixin, self).delete(*args, **kwargs)


# Path: mineid/apps/views.py
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView, CreateView, UpdateView, \
    DeleteView, DetailView
from .mixins import AppViewMixin, AppUserObjectsMixin, AppUserObjectMixin, \
    AppFormMixin, AppDeleteMixin




class AppList(AppViewMixin, AppUserObjectsMixin, ListView):
    template_name = 'mineid/apps/list.html'


class AppCreate(AppViewMixin, AppUserObjectMixin, AppFormMixin, CreateView):
    template_name = 'mineid/apps/create.html'
    form_valid_message = _('Application created')

    def get_initial(self):
        initial = super(AppCreate, self).get_initial()
        initial['url'] = 'http://'
        initial['redirect_uri'] = 'http://'
        return initial



class AppUpdate(AppViewMixin, AppUserObjectsMixin, AppFormMixin, UpdateView):