fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5400caf
)
Changed a way we access fields in TaggableModelForm to be compatibile with django...
author
Marek Stępniowski
<marek@stepniowski.com>
Thu, 28 Aug 2008 13:25:06 +0000
(15:25 +0200)
committer
Marek Stępniowski
<marek@stepniowski.com>
Thu, 28 Aug 2008 13:25:06 +0000
(15:25 +0200)
newtagging/admin.py
patch
|
blob
|
history
diff --git
a/newtagging/admin.py
b/newtagging/admin.py
index
2ecc84d
..
956d2cf
100644
(file)
--- a/
newtagging/admin.py
+++ b/
newtagging/admin.py
@@
-38,12
+38,12
@@
class TaggableModelForm(forms.ModelForm):
tags = forms.MultipleChoiceField(label=_('tags').capitalize(), required=True, widget=FilteredSelectMultiple(_('tags'), False))
def __init__(self, *args, **kwargs):
tags = forms.MultipleChoiceField(label=_('tags').capitalize(), required=True, widget=FilteredSelectMultiple(_('tags'), False))
def __init__(self, *args, **kwargs):
- self.tags.choices = [(tag.id, tag.name) for tag in self.tag_model.objects.all()]
if 'instance' in kwargs:
if 'initial' not in kwargs:
kwargs['initial'] = {}
kwargs['initial']['tags'] = [tag.id for tag in self.tag_model.objects.get_for_object(kwargs['instance'])]
super(TaggableModelForm, self).__init__(*args, **kwargs)
if 'instance' in kwargs:
if 'initial' not in kwargs:
kwargs['initial'] = {}
kwargs['initial']['tags'] = [tag.id for tag in self.tag_model.objects.get_for_object(kwargs['instance'])]
super(TaggableModelForm, self).__init__(*args, **kwargs)
+ self.fields['tags'].choices = [(tag.id, tag.name) for tag in self.tag_model.objects.all()]
def save(self, commit):
obj = super(TaggableModelForm, self).save()
def save(self, commit):
obj = super(TaggableModelForm, self).save()