chore(notes): ensure blank note cant be saved

!9
This commit is contained in:
2024-05-22 13:56:31 +09:30
parent 2689c35db3
commit 41621c6a64
4 changed files with 31 additions and 4 deletions

View File

@ -7,6 +7,33 @@ import requests
@pytest.mark.skip(reason="to be written")
def test_note_device_no_blank_note():
""" The field is set to blank=true, ensure that a blank note cant be saved
field had to be set blank=true so that other forms on same page could be saved.
"""
pass
@pytest.mark.skip(reason="to be written")
def test_note_operating_system_no_blank_note():
""" The field is set to blank=true, ensure that a blank note cant be saved
field had to be set blank=true so that other forms on same page could be saved.
"""
pass
@pytest.mark.skip(reason="to be written")
def test_note_software_no_blank_note():
""" The field is set to blank=true, ensure that a blank note cant be saved
field had to be set blank=true so that other forms on same page could be saved.
"""
pass
@pytest.mark.skip(reason="to be written")
def test_note_new_correct_usercreated():
""" The user who added the note must be added to the note """

View File

@ -125,7 +125,7 @@ class View(OrganizationPermission, generic.UpdateView):
notes = AddNoteForm(request.POST, prefix='note')
if notes.is_bound and notes.is_valid():
if notes.is_bound and notes.is_valid() and notes.instance.note != '':
notes.instance.organization = device.organization
notes.instance.device = device

View File

@ -59,7 +59,7 @@ class View(OrganizationPermission, generic.UpdateView):
context['notes'] = Notes.objects.filter(operatingsystem=self.kwargs['pk'])
context['model_pk'] = self.kwargs['pk']
context['model_name'] = 'operating_system'
context['model_name'] = self.model._meta.verbose_name.replace(' ', '')
context['content_title'] = self.object.name
@ -73,7 +73,7 @@ class View(OrganizationPermission, generic.UpdateView):
notes = AddNoteForm(request.POST, prefix='note')
if notes.is_bound and notes.is_valid():
if notes.is_bound and notes.is_valid() and notes.instance.note != '':
notes.instance.organization = operatingsystem.organization
notes.instance.operatingsystem = operatingsystem

View File

@ -88,7 +88,7 @@ class View(OrganizationPermission, generic.UpdateView):
notes = AddNoteForm(request.POST, prefix='note')
if notes.is_bound and notes.is_valid():
if notes.is_bound and notes.is_valid() and notes.instance.note != '':
notes.instance.organization = software.organization
notes.instance.software = software