git.ithinksw.org
/
philo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reduced number of queries for BlogView.get_entries_by_tag. Corrected waldo's AccountM...
[philo.git]
/
models
/
fields.py
diff --git
a/models/fields.py
b/models/fields.py
index
19a6006
..
83798c4
100644
(file)
--- a/
models/fields.py
+++ b/
models/fields.py
@@
-243,6
+243,11
@@
class JSONField(models.TextField):
def contribute_to_class(self, cls, name):
super(JSONField, self).contribute_to_class(cls, name)
setattr(cls, name, JSONDescriptor(self))
def contribute_to_class(self, cls, name):
super(JSONField, self).contribute_to_class(cls, name)
setattr(cls, name, JSONDescriptor(self))
+ models.signals.pre_init.connect(self.fix_init_kwarg, sender=cls)
+
+ def fix_init_kwarg(self, sender, args, kwargs, **signal_kwargs):
+ if self.name in kwargs:
+ kwargs[self.attname] = json.dumps(kwargs.pop(self.name))
def formfield(self, *args, **kwargs):
kwargs["form_class"] = JSONFormField
def formfield(self, *args, **kwargs):
kwargs["form_class"] = JSONFormField