Add teams and internationalization

This commit is contained in:
rucki
2026-08-23 14:55:04 +02:00
parent 218d841d7f
commit c409fbc441
26 changed files with 1582 additions and 149 deletions
+34 -11
View File
@@ -1,6 +1,7 @@
from django import forms
from django.contrib.auth.models import User
from .models import ApiKey, Attachment, Item, Kanban, Tag, UserPreference
from django.utils.translation import gettext_lazy as _
from .models import ApiKey, Attachment, Item, Kanban, Tag, Team, TeamInvite, UserPreference
class MultipleFileInput(forms.ClearableFileInput):
@@ -24,7 +25,7 @@ class QuickItemForm(forms.ModelForm):
widgets = {'content': forms.Textarea(attrs={
'class': 'form-control form-control-lg',
'rows': 3,
'placeholder': 'Schreibe etwas … /todo /link /public #tag [[note:1]]',
'placeholder': _('Write something … /todo /link /public #tag [[note:1]]'),
'x-model': 'text',
'@keydown': 'onKeydown($event)',
'@input': 'onInput($event)',
@@ -61,23 +62,45 @@ class UserPreferenceForm(forms.ModelForm):
model = UserPreference
fields = ['show_notes', 'show_open_todos', 'show_done_todos', 'show_links', 'show_journal', 'overview_lines']
labels = {
'show_notes': 'Notizen anzeigen',
'show_open_todos': 'Offene Aufgaben anzeigen',
'show_done_todos': 'Erledigte Aufgaben anzeigen',
'show_links': 'Links anzeigen',
'show_journal': 'Journal anzeigen',
'overview_lines': 'Zeilen in der Übersicht',
'show_notes': _('Show notes'),
'show_open_todos': _('Show open tasks'),
'show_done_todos': _('Show completed tasks'),
'show_links': _('Show links'),
'show_journal': _('Show journal'),
'overview_lines': _('Lines in overview'),
}
widgets = {'overview_lines': forms.NumberInput(attrs={'class': 'form-control', 'min': 1, 'max': 50})}
class TeamForm(forms.ModelForm):
class Meta:
model = Team
fields = ['name', 'slug']
labels = {'name': _('Team name'), 'slug': _('Team tag')}
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'my2dos'}),
'slug': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'my2dos'}),
}
def clean_slug(self):
return self.cleaned_data['slug'].strip().lstrip('#').lower()
class TeamInviteForm(forms.ModelForm):
class Meta:
model = TeamInvite
fields = ['email']
labels = {'email': _('Email')}
widgets = {'email': forms.EmailInput(attrs={'class': 'form-control', 'placeholder': 'person@example.com'})}
class KanbanForm(forms.ModelForm):
tag_name = forms.CharField(label='Tag', widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'my2dos'}))
tag_name = forms.CharField(label=_('Tag'), widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'my2dos'}))
class Meta:
model = Kanban
fields = ['name', 'tag_name']
widgets = {'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Name des Kanbans'})}
widgets = {'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': _('Kanban name')})}
def save(self, commit=True):
tag_name = self.cleaned_data['tag_name'].strip().lstrip('#').lower()
@@ -91,7 +114,7 @@ class ApiKeyForm(forms.ModelForm):
model = ApiKey
fields = ['name', 'tags']
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Name des API Keys'}),
'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': _('API key name')}),
'tags': forms.CheckboxSelectMultiple(),
}