Make display_mode and page_size blank

This commit is contained in:
shamoon
2024-04-18 09:29:56 -07:00
parent d8e7113fef
commit 8d96e22591
11 changed files with 37 additions and 24 deletions

View File

@@ -17,19 +17,25 @@ class Migration(migrations.Migration):
model_name="savedview",
name="display_mode",
field=models.CharField(
choices=[("table", "Table"), ("smallCards", "Small Cards")],
default="table",
blank=True,
choices=[
("table", "Table"),
("smallCards", "Small Cards"),
("largeCards", "Large Cards"),
],
max_length=128,
verbose_name="Dashboard view display mode",
null=True,
verbose_name="View display mode",
),
),
migrations.AddField(
model_name="savedview",
name="page_size",
field=models.PositiveIntegerField(
default=10,
blank=True,
null=True,
validators=[django.core.validators.MinValueValidator(1)],
verbose_name="Dashboard view limit",
verbose_name="View page size",
),
),
migrations.AddField(
@@ -45,7 +51,7 @@ class Migration(migrations.Migration):
("correspondent", "Correspondent"),
("storagepath", "Storage Path"),
],
default="created,title,tags,correspondent",
default="created,title,tag,correspondent",
max_length=128,
),
),

View File

@@ -555,6 +555,7 @@ class SavedView(ModelWithOwner):
class ViewDisplayMode(models.TextChoices):
TABLE = ("table", _("Table"))
SMALL_CARDS = ("smallCards", _("Small Cards"))
LARGE_CARDS = ("largeCards", _("Large Cards"))
class DocumentDisplayFields(models.TextChoices):
TITLE = ("title", _("Title"))
@@ -587,7 +588,8 @@ class SavedView(ModelWithOwner):
page_size = models.PositiveIntegerField(
_("View page size"),
default=10,
null=True,
blank=True,
validators=[MinValueValidator(1)],
)
@@ -595,7 +597,8 @@ class SavedView(ModelWithOwner):
max_length=128,
verbose_name=_("View display mode"),
choices=ViewDisplayMode.choices,
default=ViewDisplayMode.TABLE,
null=True,
blank=True,
)
document_display_fields = DynamicMultiSelectField(

View File

@@ -1614,7 +1614,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
status.HTTP_404_NOT_FOUND,
)
def test_create_update_patch(self):
def test_savedview_create_update_patch(self):
User.objects.create_user("user1")
view = {