diff --git a/django_x509/base/models.py b/django_x509/base/models.py index 85ad706..021dfef 100644 --- a/django_x509/base/models.py +++ b/django_x509/base/models.py @@ -201,6 +201,7 @@ def clean(self): def save(self, *args, **kwargs): if not self.pk and not self.certificate and not self.private_key: + #removed these lines and any reference to the generate variable if not self.serial_number: self.serial_number = self._generate_serial_number() self._generate() diff --git a/django_x509/tests/test_cert.py b/django_x509/tests/test_cert.py index c519400..91e1817 100644 --- a/django_x509/tests/test_cert.py +++ b/django_x509/tests/test_cert.py @@ -82,6 +82,7 @@ class TestCert(TestX509Mixin, TestCase): """ def test_new(self): + #added assertNumQueries to check the number of queries made with self.assertNumQueries(3): # 3 query to be made cert = self._create_cert() self.assertNotEqual(cert.certificate, '')