renamed List to Note everywhere thru-out project in preparation for complete overhaul of applet capabilities

This commit is contained in:
Disco DeDisco
2026-03-11 13:59:43 -04:00
parent aa1cef6e7b
commit f45740d8b3
29 changed files with 435 additions and 394 deletions

View File

@@ -2,8 +2,8 @@ from django import forms
from django.core.exceptions import ValidationError
from .models import Item
DUPLICATE_ITEM_ERROR = "You've already logged this to your list"
EMPTY_ITEM_ERROR = "You can't have an empty list item"
DUPLICATE_ITEM_ERROR = "You've already logged this to your note"
EMPTY_ITEM_ERROR = "You can't have an empty note item"
class ItemForm(forms.Form):
text = forms.CharField(
@@ -11,22 +11,22 @@ class ItemForm(forms.Form):
required=True,
)
def save(self, for_list):
def save(self, for_note):
return Item.objects.create(
list=for_list,
note=for_note,
text=self.cleaned_data["text"],
)
class ExistingListItemForm(ItemForm):
def __init__(self, for_list, *args, **kwargs):
class ExistingNoteItemForm(ItemForm):
def __init__(self, for_note, *args, **kwargs):
super().__init__(*args, **kwargs)
self._for_list = for_list
self._for_note = for_note
def clean_text(self):
text = self.cleaned_data["text"]
if self._for_list.item_set.filter(text=text).exists():
if self._for_note.item_set.filter(text=text).exists():
raise forms.ValidationError(DUPLICATE_ITEM_ERROR)
return text
def save(self):
return super().save(for_list=self._for_list)
return super().save(for_note=self._for_note)