From 1169680a2dc27e43acea2772e26e62ea063941a8 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 25 Apr 2017 11:08:17 +0200 Subject: [PATCH] fix initial in tag forms --- apps/catalogue/forms.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index 4b6a37bb..36dbef73 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -52,7 +52,7 @@ class TagForm(forms.Form): 'data-content': category.tutorial, }) if self.instance: - self.field().initial = self.initial() + self.field().initial = self.get_initial() def save(self, instance=None): instance = instance or self.instance @@ -62,7 +62,7 @@ class TagForm(forms.Form): def field(self): raise NotImplementedError - def initial(self): + def get_initial(self): raise NotImplementedError def cleaned_tags(self): @@ -107,7 +107,7 @@ class TagSingleForm(TagForm): def field(self): return self.fields['tag'] - def initial(self): + def get_initial(self): return self.instance.tags.get(category=self.category) def cleaned_tags(self): @@ -125,7 +125,7 @@ class TagMultipleForm(TagForm): def field(self): return self.fields['tags'] - def initial(self): + def get_initial(self): return self.instance.tags.filter(category=self.category) def cleaned_tags(self): -- 2.20.1