Skip to content

Commit

Permalink
Merge pull request #92 from benjaoming/clean-fk-access
Browse files Browse the repository at this point in the history
Do not access Settings.user when Settings.pk is unset
  • Loading branch information
benjaoming authored Dec 30, 2019
2 parents c7b2250 + 701e77d commit e0cd63a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion django_nyt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_disable_notifications = False

__version__ = "1.1.4"
__version__ = "1.1.5"

default_app_config = "django_nyt.apps.DjangoNytConfig"
2 changes: 1 addition & 1 deletion django_nyt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Meta:
verbose_name_plural = _('settings')

def clean(self):
if not self.is_default:
if not self.is_default and self.pk and self.user:
default_settings = Settings.objects.filter(
user=self.user,
is_default=True,
Expand Down
10 changes: 10 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Release Notes
=============

1.1.5
-----

Fixed
^^^^^

* Do not access ``Settings.user`` in ``Settings.clean()`` on blank new objects :url-issue:`92`


1.1.4
-----

Expand All @@ -9,6 +18,7 @@ Added

* Django 3.0 support (added to test matrix)


1.1.3
-----

Expand Down

0 comments on commit e0cd63a

Please sign in to comment.