0

I can create an object from a specific model with the generic class based view CreateView, which has a Taggit field. I also have a ModelForm based in that model. I insert many taggs separated with a comma, without any problem. I also can update it properly from my admin interface.

The problem comes, when I update the model with the generic UpdateView which is based in a ModelForm of that model. My Taggit field appears like that in the textfield:

[<TaggedItem: tag1>, <TaggedItem: tag2>, <TaggedItem: tag3>]

How can I show it, as the same way as in the admin interface?

which in this case, would be:

tag1,tag2,tag3
cor
  • 3,323
  • 25
  • 46
  • use the same widget which is used in the admin interface .) – yedpodtrzitko Jun 03 '14 at 10:51
  • Thanks, yes, the problem comes when I add a widget to that field at the ModelForm: 'tags' : forms.TextInput(attrs={'class':'form-control'}). Without that works fine, but the textfield looks odd – cor Jun 03 '14 at 11:17
  • yes, there are some special css rules in the .css file used in admin (and maybe some extra javascript too) – yedpodtrzitko Jun 03 '14 at 11:28
  • But how can I add my custom widget without losing the format of the content? – cor Jun 03 '14 at 12:08

0 Answers0