From 83c2aaa499f6da3b82f8c2d9c90b61a3b249e9a6 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 11 Aug 2023 10:50:11 -0500 Subject: [PATCH] fix: only require names, title, and email i.e. let all other fields `blank=True` --- .../0004_require_only_certain_fields.py | 62 +++++++++++++++++++ apps/tup-cms/src/apps/staff_profile/models.py | 26 ++++---- 2 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 apps/tup-cms/src/apps/staff_profile/migrations/0004_require_only_certain_fields.py diff --git a/apps/tup-cms/src/apps/staff_profile/migrations/0004_require_only_certain_fields.py b/apps/tup-cms/src/apps/staff_profile/migrations/0004_require_only_certain_fields.py new file mode 100644 index 000000000..3fa112e2f --- /dev/null +++ b/apps/tup-cms/src/apps/staff_profile/migrations/0004_require_only_certain_fields.py @@ -0,0 +1,62 @@ +# Generated by Django 3.2.18 on 2023-08-11 15:44 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import filer.fields.image + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.FILER_IMAGE_MODEL), + ('staff_profile', '0003_reduce_first_last_name_length'), + ] + + operations = [ + migrations.AlterField( + model_name='staffprofileplugin', + name='department', + field=models.CharField(blank=True, max_length=100), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='education', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='experience', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='memberships', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='phone', + field=models.CharField(blank=True, max_length=50, null=True), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='photo', + field=filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.FILER_IMAGE_MODEL), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='projects', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='publications', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='staffprofileplugin', + name='research_areas', + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/apps/tup-cms/src/apps/staff_profile/models.py b/apps/tup-cms/src/apps/staff_profile/models.py index e48a4acd0..5e780f49b 100644 --- a/apps/tup-cms/src/apps/staff_profile/models.py +++ b/apps/tup-cms/src/apps/staff_profile/models.py @@ -8,20 +8,20 @@ class StaffProfilePlugin(CMSPlugin): """ Model for CMS staff profile pages. """ - first_name = models.CharField(max_length=100) - last_name = models.CharField(max_length=100) - title = models.CharField(max_length=100) - email = models.CharField(max_length=100) - department = models.CharField(max_length=100) - phone = models.CharField(max_length=50, null=True) + first_name = models.CharField(max_length=100, blank=False) + last_name = models.CharField(max_length=100, blank=False) + title = models.CharField(max_length=100, blank=False) + email = models.CharField(max_length=100, blank=False) + department = models.CharField(max_length=100, blank=True) + phone = models.CharField(max_length=50, null=True, blank=True) description = models.TextField() - photo = FilerImageField(on_delete=models.CASCADE, null=True) + photo = FilerImageField(on_delete=models.CASCADE, null=True, blank=True) - publications = models.TextField(null=True) - projects = models.TextField(null=True) - education = models.TextField(null=True) - research_areas = models.TextField(null=True) - memberships = models.TextField(null=True) - experience = models.TextField(null=True) + publications = models.TextField(null=True, blank=True) + projects = models.TextField(null=True, blank=True) + education = models.TextField(null=True, blank=True) + research_areas = models.TextField(null=True, blank=True) + memberships = models.TextField(null=True, blank=True) + experience = models.TextField(null=True, blank=True)