I have a tests.py that looks like this:
from django_dynamic_fixture import G,N
from person.models import Person
from django.test import TestCase
class EmailSendTests(TestCase):
def test_send_email(self):
person = N(Person)
My Person model looks like this:
class Person(models.Model):
person_no = models.IntegerField(primary_key=True)
address = models.ForeignKey('Address', db_column = 'address_no')
guarantor = models.ForeignKey('Person', db_column = 'gperson_no')
When I run the tests, I get the following:
ValueError: Cannot assign None: "Patient.guarantor" does not allow null values.
How do I create a django_dynamic_fixture object that has a foreignkey pointing to itself?