Make email and notes required, fix unit test

This commit is contained in:
Rachid Mrad 2024-01-23 18:58:26 -05:00
parent 784b187b09
commit 8570a03600
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
3 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
# Generated by Django 4.2.7 on 2024-01-23 21:02
# Generated by Django 4.2.7 on 2024-01-23 23:51
from django.conf import settings
from django.db import migrations, models
@ -17,8 +17,8 @@ class Migration(migrations.Migration):
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("email", models.EmailField(blank=True, db_index=True, help_text="Email", max_length=254)),
("notes", models.TextField(blank=True, help_text="Notes")),
("email", models.EmailField(db_index=True, help_text="Email", max_length=254)),
("notes", models.TextField(help_text="Notes")),
(
"requestor",
models.ForeignKey(

View file

@ -9,7 +9,7 @@ class VeryImportantPerson(TimeStampedModel):
email = models.EmailField(
null=False,
blank=True,
blank=False,
help_text="Email",
db_index=True,
)
@ -24,7 +24,7 @@ class VeryImportantPerson(TimeStampedModel):
notes = models.TextField(
null=False,
blank=True,
blank=False,
help_text="Notes",
)

View file

@ -1748,7 +1748,7 @@ class VeryImportantPersonAdminTestCase(TestCase):
def test_save_model_sets_user_field(self):
self.client.force_login(self.superuser)
# Create an instance of the admin class
admin_instance = VeryImportantPersonAdmin(model=VeryImportantPerson, admin_site=None)
@ -1757,7 +1757,7 @@ class VeryImportantPersonAdminTestCase(TestCase):
# Create a request object
request = self.factory.post("/admin/yourapp/veryimportantperson/add/")
request.requestor = self.superuser
request.user = self.superuser
# Call the save_model method
admin_instance.save_model(request, vip_instance, None, None)