diff --git a/scrapy/tests/test_djangoitem/__init__.py b/scrapy/tests/test_djangoitem/__init__.py index 46ce4a012..e3ffb176f 100644 --- a/scrapy/tests/test_djangoitem/__init__.py +++ b/scrapy/tests/test_djangoitem/__init__.py @@ -78,3 +78,7 @@ class DjangoItemTest(unittest.TestCase): self.assertEqual(person.name, 'John') + def test_default_field_values(self): + i = BasePersonItem() + person = i.save(commit=False) + self.assertEqual(person.name, 'Robot') diff --git a/scrapy/tests/test_djangoitem/models.py b/scrapy/tests/test_djangoitem/models.py index d2098632a..2beaee752 100644 --- a/scrapy/tests/test_djangoitem/models.py +++ b/scrapy/tests/test_djangoitem/models.py @@ -2,7 +2,7 @@ from django.db import models class Person(models.Model): - name = models.CharField(max_length=255) + name = models.CharField(max_length=255, default='Robot') age = models.IntegerField() class Meta: