git.ithinksw.org
/
philo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release/0.9.2'
[philo.git]
/
philo
/
admin
/
forms
/
attributes.py
diff --git
a/philo/admin/forms/attributes.py
b/philo/admin/forms/attributes.py
index
5372ab3
..
4a6dd67
100644
(file)
--- a/
philo/admin/forms/attributes.py
+++ b/
philo/admin/forms/attributes.py
@@
-21,7
+21,7
@@
class AttributeForm(ModelForm):
# This is necessary because model forms store changes to self.instance in their clean method.
# Mutter mutter.
value = self.instance.value
# This is necessary because model forms store changes to self.instance in their clean method.
# Mutter mutter.
value = self.instance.value
- self._cached_value_ct
= self.instance.value_content_type
+ self._cached_value_ct
_id = self.instance.value_content_type_id
self._cached_value = value
# If there is a value, pull in its fields.
self._cached_value = value
# If there is a value, pull in its fields.
@@
-32,7
+32,7
@@
class AttributeForm(ModelForm):
def save(self, *args, **kwargs):
# At this point, the cleaned_data has already been stored on self.instance.
def save(self, *args, **kwargs):
# At this point, the cleaned_data has already been stored on self.instance.
- if self.instance.value_content_type
!= self._cached_value_ct
:
+ if self.instance.value_content_type
_id != self._cached_value_ct_id
:
# The value content type has changed. Clear the old value, if there was one.
if self._cached_value:
self._cached_value.delete()
# The value content type has changed. Clear the old value, if there was one.
if self._cached_value:
self._cached_value.delete()
@@
-42,8
+42,8
@@
class AttributeForm(ModelForm):
# Now create a new value instance so that on next instantiation, the form will
# know what fields to add.
# Now create a new value instance so that on next instantiation, the form will
# know what fields to add.
- if self.instance.value_content_type is not None:
- self.instance.value =
self.instance.value_content_type
.model_class().objects.create()
+ if self.instance.value_content_type
_id
is not None:
+ self.instance.value =
ContentType.objects.get_for_id(self.instance.value_content_type_id)
.model_class().objects.create()
elif self.instance.value is not None:
# The value content type is the same, but one of the value fields has changed.
elif self.instance.value is not None:
# The value content type is the same, but one of the value fields has changed.