Add kanban updates and static root
This commit is contained in:
+16
-1
@@ -1,6 +1,6 @@
|
||||
from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
from .models import ApiKey, Attachment, Item, UserPreference
|
||||
from .models import ApiKey, Attachment, Item, Kanban, Tag, UserPreference
|
||||
|
||||
|
||||
class MultipleFileInput(forms.ClearableFileInput):
|
||||
@@ -71,6 +71,21 @@ class UserPreferenceForm(forms.ModelForm):
|
||||
widgets = {'overview_lines': forms.NumberInput(attrs={'class': 'form-control', 'min': 1, 'max': 50})}
|
||||
|
||||
|
||||
class KanbanForm(forms.ModelForm):
|
||||
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'})}
|
||||
|
||||
def save(self, commit=True):
|
||||
tag_name = self.cleaned_data['tag_name'].strip().lstrip('#').lower()
|
||||
tag, _ = Tag.objects.get_or_create(name=tag_name)
|
||||
self.instance.tag = tag
|
||||
return super().save(commit=commit)
|
||||
|
||||
|
||||
class ApiKeyForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = ApiKey
|
||||
|
||||
Reference in New Issue
Block a user