-
- {{ application_count }}
-
+
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/passbook/admin/templates/administration/source/create.html b/passbook/admin/templates/administration/source/create.html
new file mode 100644
index 000000000..eff352942
--- /dev/null
+++ b/passbook/admin/templates/administration/source/create.html
@@ -0,0 +1,11 @@
+{% extends "generic/create.html" %}
+
+{% load i18n %}
+
+{% block title %}
+{% blocktrans with type=request.GET.type %}Create {{ type }}{% endblocktrans %}
+{% endblock %}
+
+{% block above_form %}
+
{% blocktrans with type=request.GET.type %}Create {{ type }}{% endblocktrans %}
+{% endblock %}
\ No newline at end of file
diff --git a/passbook/admin/templates/administration/source/list.html b/passbook/admin/templates/administration/source/list.html
index 0bafa6a7c..a79a8fa27 100644
--- a/passbook/admin/templates/administration/source/list.html
+++ b/passbook/admin/templates/administration/source/list.html
@@ -1,18 +1,41 @@
-{% extends "generic/list.html" %}
+{% extends "administration/base.html" %}
{% load i18n %}
+{% load utils %}
-{% block above_table %}
-
-
-
+{% block content %}
+
+
+
+
+
+
+
+
+
+ {% trans 'Name' %} |
+ {% trans 'Class' %} |
+ |
+ |
+
+
+
+ {% for source in object_list %}
+
+ {{ source.name }} |
+ {{ source.cast|fieldtype }} |
+ {% trans 'Edit' %} |
+ {% trans 'Delete' %} |
+
+ {% endfor %}
+
+
-
{% endblock %}
\ No newline at end of file
diff --git a/passbook/admin/urls.py b/passbook/admin/urls.py
index 5816869a8..5b511cebd 100644
--- a/passbook/admin/urls.py
+++ b/passbook/admin/urls.py
@@ -1,7 +1,7 @@
"""passbook URL Configuration"""
from django.urls import path
-from passbook.admin.views import applications, overview, sources
+from passbook.admin.views import applications, overview, rules, sources
urlpatterns = [
path('', overview.AdministrationOverviewView.as_view(), name='overview'),
@@ -14,6 +14,7 @@ urlpatterns = [
applications.ApplicationUpdateView.as_view(), name='application-update'),
path('applications/
/delete/',
applications.ApplicationDeleteView.as_view(), name='application-delete'),
+ # Sources
path('sources/', sources.SourceListView.as_view(), name='sources'),
path('sources/create/', sources.SourceCreateView.as_view(), name='source-create'),
path('sources//update/', sources.SourceUpdateView.as_view(), name='source-update'),
diff --git a/passbook/admin/views/sources.py b/passbook/admin/views/sources.py
index 288b133ca..f40b3c237 100644
--- a/passbook/admin/views/sources.py
+++ b/passbook/admin/views/sources.py
@@ -21,11 +21,14 @@ class SourceListView(AdminRequiredMixin, ListView):
x.__name__: x._meta.verbose_name for x in Source.__subclasses__()}
return super().get_context_data(**kwargs)
+ def get_queryset(self):
+ return super().get_queryset().select_subclasses()
+
class SourceCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView):
"""Create new Source"""
- template_name = 'generic/create.html'
+ template_name = 'administration/source/create.html'
success_url = reverse_lazy('passbook_admin:sources')
success_message = _('Successfully created Source')
diff --git a/passbook/core/forms/applications.py b/passbook/core/forms/applications.py
new file mode 100644
index 000000000..4a1d364b0
--- /dev/null
+++ b/passbook/core/forms/applications.py
@@ -0,0 +1,18 @@
+"""passbook Core Application forms"""
+from django import forms
+
+from passbook.core.models import Application
+
+
+class ApplicationForm(forms.ModelForm):
+ """Application Form"""
+
+ class Meta:
+
+ model = Application
+ fields = ['name', 'launch_url', 'icon_url', 'rules', 'provider', 'skip_authorization']
+ widgets = {
+ 'name': forms.TextInput(),
+ 'launch_url': forms.TextInput(),
+ 'icon_url': forms.TextInput(),
+ }
diff --git a/passbook/ldap/forms.py b/passbook/ldap/forms.py
index 84eb7655a..4bd2f88c0 100644
--- a/passbook/ldap/forms.py
+++ b/passbook/ldap/forms.py
@@ -14,6 +14,14 @@ class LDAPSourceForm(forms.ModelForm):
model = LDAPSource
fields = SOURCE_FORM_FIELDS + ['server_uri', 'bind_cn', 'bind_password',
'type', 'domain', 'base_dn', 'create_user', 'reset_password']
+ widgets = {
+ 'name': forms.TextInput(),
+ 'server_uri': forms.TextInput(),
+ 'bind_cn': forms.TextInput(),
+ 'bind_password': forms.TextInput(),
+ 'domain': forms.TextInput(),
+ 'base_dn': forms.TextInput(),
+ }
# class GeneralSettingsForm(SettingsForm):
# """general settings form"""
diff --git a/passbook/ldap/models.py b/passbook/ldap/models.py
index e743af105..decd969ac 100644
--- a/passbook/ldap/models.py
+++ b/passbook/ldap/models.py
@@ -12,8 +12,8 @@ class LDAPSource(Source):
TYPE_ACTIVE_DIRECTORY = 'ad'
TYPE_GENERIC = 'generic'
TYPES = (
- (TYPE_ACTIVE_DIRECTORY, TYPE_ACTIVE_DIRECTORY),
- (TYPE_GENERIC, TYPE_GENERIC),
+ (TYPE_ACTIVE_DIRECTORY, _('Active Directory')),
+ (TYPE_GENERIC, _('Generic')),
)
server_uri = models.TextField()