--- /dev/null
+from django.apps import AppConfig
+from django.utils.translation import ugettext_lazy as _
+
+
+class AccountsConfig(AppConfig):
+ name = 'accounts'
+ verbose_name = _('Accounts')
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-03-29 14:19+0100\n"
+"POT-Creation-Date: 2019-03-30 22:52+0100\n"
"PO-Revision-Date: 2019-03-29 14:15+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Language-Team: \n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.6\n"
-#: templates/account/base.html:8
+#: templates/account/base.html:9
msgid "Change at Gravatar.com"
msgstr "Zmień na Gravatar.com"
-#: templates/account/base.html:10 templates/account/profile.html:5
+#: templates/account/base.html:11 templates/account/profile.html:5
#: templates/account/profile.html:16
msgid "Your profile"
msgstr "Twój profil"
-#: templates/account/base.html:11
+#: templates/account/base.html:12
#: templates/registration/password_change_done.html:14
msgid "Password change"
msgstr ""
-#: templates/account/base.html:12
+#: templates/account/base.html:13
msgid "E-mail"
msgstr "E-mail"
-#: templates/account/base.html:13
+#: templates/account/base.html:16
msgid "SSH keys"
msgstr "Klucze SSH"
-#: templates/account/base.html:15
+#: templates/account/base.html:21
+msgid "Administration"
+msgstr ""
+
+#: templates/account/base.html:23
msgid "Logout"
msgstr "Wyloguj"
<p><a {% if menu == 'ssh' %}class="active"{% endif %} href="{% url 'ssh_keys' %}">{% trans "SSH keys" %}</a></p>
{% endif %}
{% endblock %}
+
+ {% if request.user.is_staff %}
+ <p><a href='/admin/'>{% trans "Administration" %}</a></p>
+ {% endif %}
<p><a href="{% url 'cas_logout' %}">{% trans "Logout" %}</a></p>
</aside>
)
INSTALLED_APPS = (
- 'accounts',
- 'services',
- 'ssh_keys',
+ 'accounts.apps.AccountsConfig',
+ 'services.apps.ServicesConfig',
+ 'ssh_keys.apps.SshKeysConfig',
'cas_provider',
'django_gravatar',
.menu img {
box-shadow: 0 0 .2em black;
}
+
+code.key {
+ word-wrap: break-word;
+}
from django.apps import AppConfig
+from django.utils.translation import ugettext_lazy as _
class ServicesConfig(AppConfig):
name = 'services'
+ verbose_name = _("Services")
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-03-30 23:12+0100\n"
+"PO-Revision-Date: 2019-03-30 23:13+0100\n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n"
+"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n"
+"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"X-Generator: Poedit 2.0.6\n"
+
+#: apps.py:7
+msgid "Services"
+msgstr "Serwisy"
+
+#: models.py:8
+msgid "name"
+msgstr "nazwa"
+
+#: models.py:9
+msgid "URL"
+msgstr "URL"
+
+#: models.py:10
+msgid "key"
+msgstr "klucz"
+
+#: models.py:11
+msgid "uses SSH"
+msgstr "używa SSH"
+
+#: models.py:12
+msgid "groups"
+msgstr "grupy"
+
+#: models.py:13
+msgid "users"
+msgstr "użytkownicy"
+
+#: models.py:17
+msgid "service"
+msgstr "serwis"
+
+#: models.py:18
+msgid "services"
+msgstr "serwisy"
--- /dev/null
+# Generated by Django 2.1.7 on 2019-03-30 22:20
+
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('services', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='service',
+ options={'ordering': ('name',), 'verbose_name': 'service', 'verbose_name_plural': 'services'},
+ ),
+ migrations.AlterField(
+ model_name='service',
+ name='groups',
+ field=models.ManyToManyField(blank=True, to='auth.Group', verbose_name='groups'),
+ ),
+ migrations.AlterField(
+ model_name='service',
+ name='key',
+ field=models.CharField(blank=True, max_length=255, verbose_name='key'),
+ ),
+ migrations.AlterField(
+ model_name='service',
+ name='name',
+ field=models.CharField(max_length=255, verbose_name='name'),
+ ),
+ migrations.AlterField(
+ model_name='service',
+ name='url',
+ field=models.URLField(blank=True, verbose_name='URL'),
+ ),
+ migrations.AlterField(
+ model_name='service',
+ name='users',
+ field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='users'),
+ ),
+ migrations.AlterField(
+ model_name='service',
+ name='uses_ssh',
+ field=models.BooleanField(default=False, verbose_name='uses SSH'),
+ ),
+ ]
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
+from django.utils.translation import ugettext_lazy as _
class Service(models.Model):
- name = models.CharField(max_length=255)
- url = models.URLField(blank=True)
- key = models.CharField(max_length=255, blank=True)
- uses_ssh = models.BooleanField(default=False)
- groups = models.ManyToManyField('auth.Group', blank=True)
- users = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)
+ name = models.CharField(_('name'), max_length=255)
+ url = models.URLField(_('URL'), blank=True)
+ key = models.CharField(_('key'), max_length=255, blank=True)
+ uses_ssh = models.BooleanField(_('uses SSH'), default=False)
+ groups = models.ManyToManyField('auth.Group', verbose_name=_('groups'), blank=True)
+ users = models.ManyToManyField(settings.AUTH_USER_MODEL, verbose_name=_('users'), blank=True)
class Meta:
ordering = ('name', )
+ verbose_name = _('service')
+ verbose_name_plural = _('services')
def __str__(self):
return self.name
from django.apps import AppConfig
+from django.utils.translation import ugettext_lazy as _
class SshKeysConfig(AppConfig):
name = 'ssh_keys'
+ verbose_name = _('SSH keys')
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-03-30 23:22+0100\n"
+"PO-Revision-Date: 2019-03-30 23:22+0100\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n"
+"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n"
+"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
+"X-Generator: Poedit 2.0.6\n"
+
+#: apps.py:7 models.py:15 templates/ssh_keys/sshkey_list.html:13
+msgid "SSH keys"
+msgstr "Klucze SSH"
+
+#: models.py:7
+msgid "user"
+msgstr "użytkownik"
+
+#: models.py:8
+msgid "key"
+msgstr "klucz"
+
+#: models.py:9
+msgid "comment"
+msgstr "komentarz"
+
+#: models.py:10
+msgid "created at"
+msgstr "utworzony"
+
+#: models.py:14
+msgid "SSH key"
+msgstr "klucz SSH"
+
+#: templates/ssh_keys/sshkey_add.html:6
+msgid "Add SSH key"
+msgstr "Dodaj klucz SSH"
+
+#: templates/ssh_keys/sshkey_add.html:12 templates/ssh_keys/sshkey_list.html:27
+msgid "Add"
+msgstr "Dodaj"
+
+#: templates/ssh_keys/sshkey_confirm_delete.html:6
+msgid "Confirm deleting an SSH key"
+msgstr "Potwierdź usunięcie klucza SSH"
+
+#: templates/ssh_keys/sshkey_confirm_delete.html:8
+msgid "Are you sure you want to delete this key?"
+msgstr "Czy na pewno chcesz usunąć ten klucz?"
+
+#: templates/ssh_keys/sshkey_confirm_delete.html:14
+#: templates/ssh_keys/sshkey_list.html:18
+msgid "Added at"
+msgstr "Dodano"
+
+#: templates/ssh_keys/sshkey_confirm_delete.html:17
+#: templates/ssh_keys/sshkey_list.html:20
+msgid "Delete"
+msgstr "Usuń"
--- /dev/null
+# Generated by Django 2.1.7 on 2019-03-30 22:20
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ssh_keys', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='sshkey',
+ options={'ordering': ['created_at'], 'verbose_name': 'SSH key', 'verbose_name_plural': 'SSH keys'},
+ ),
+ migrations.AddField(
+ model_name='sshkey',
+ name='comment',
+ field=models.CharField(blank=True, max_length=255, verbose_name='comment'),
+ ),
+ migrations.AlterField(
+ model_name='sshkey',
+ name='created_at',
+ field=models.DateTimeField(auto_now_add=True, verbose_name='created at'),
+ ),
+ migrations.AlterField(
+ model_name='sshkey',
+ name='key',
+ field=models.TextField(verbose_name='key'),
+ ),
+ migrations.AlterField(
+ model_name='sshkey',
+ name='user',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user'),
+ ),
+ ]
from django.conf import settings
from django.db import models
+from django.utils.translation import ugettext_lazy as _
class SSHKey(models.Model):
- user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
- key = models.TextField()
- created_at = models.DateTimeField(auto_now_add=True)
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, verbose_name=_('user'))
+ key = models.TextField(_('key'))
+ comment = models.CharField(_('comment'), max_length=255, blank=True)
+ created_at = models.DateTimeField(_('created at'), auto_now_add=True)
class Meta:
ordering = ['created_at']
+ verbose_name = _('SSH key')
+ verbose_name_plural = _('SSH keys')
+
+ def __str__(self):
+ return self.comment
+
+ def save(self, *args, **kwargs):
+ self.comment = self.key.rsplit()[-1][:255]
+ return super().save(*args, **kwargs)
{% block accounts-content %}
<h1>{% trans "Confirm deleting an SSH key" %}</h1>
-<p>Are you sure you want to delete this key?</p>
+<p>{% trans "Are you sure you want to delete this key?" %}</p>
<form method="post">
{% csrf_token %}
{% for key in object_list %}
<p>
- <code style='word-wrap:break-word'>{{ key.key }}</code><br>
+ <code class="key">{{ key.key }}</code><br>
{% trans "Added at" %} {{ key.created_at }}<br>
<a href="{% url 'ssh_keys_delete' key.id %}">
{% trans "Delete" %}