fnp
/
edumed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hide banner
[edumed.git]
/
contact
/
models.py
diff --git
a/contact/models.py
b/contact/models.py
index
fb8c8ac
..
fac089a
100644
(file)
--- a/
contact/models.py
+++ b/
contact/models.py
@@
-28,12
+28,12
@@
class Contact(models.Model):
body = JSONField(_('body'))
key = models.CharField(max_length=KEY_SIZE)
body = JSONField(_('body'))
key = models.CharField(max_length=KEY_SIZE)
- @classmethod
- def generate_key(cls):
+ def generate_key(self):
key = ''
key = ''
- while not key or
cls
.objects.filter(key=key).exists():
+ while not key or
Contact
.objects.filter(key=key).exists():
key = make_key(KEY_SIZE)
key = make_key(KEY_SIZE)
- return key
+ self.key = key
+ self.save()
@staticmethod
def pretty_print(value, for_html=False):
@staticmethod
def pretty_print(value, for_html=False):