Skip to content

Commit

Permalink
Merge pull request #1 from Bouke/patch-1
Browse files Browse the repository at this point in the history
Fix for fetching related information / dynamic immutable_lock_field
ignores immutability for fields beginning with _
  • Loading branch information
timdiggins committed Mar 12, 2013
2 parents 6295ca5 + 3f79a14 commit 5c9d3a7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions immutablemodel/models.py
Expand Up @@ -148,6 +148,8 @@ class ImmutableModel(models.Model):
__metaclass__ = ImmutableModelMeta

def can_change_field(self, field_name):
if field_name.startswith('_'):
return True # allow changing private fields, no matter immutability
field_changable = field_name in self._meta.mutable_fields or not self.is_immutable()
if not field_changable and field_name == self._meta.pk.attname:
if getattr(self, '_deleting_immutable_model', False):
Expand Down

0 comments on commit 5c9d3a7

Please sign in to comment.