def test_custom_selected_tags(self):
     widget = LabelWidget(model=MyCustomTag)
     return_list = widget.tag_list([t.name for t in self.post.tags.all()])
     self.assertEqual(
         ["Coffee"], [tag[0] for tag in return_list if tag[1] == "selected"]
     )
     self.assertEqual(["tea"], [tag[0] for tag in return_list if tag[1] == ""])
 def test_custom_selected_tags(self):
     widget = LabelWidget(model=MyCustomTag)
     return_list = widget.tag_list([t.name for t in self.post.tags.all()])
     self.assertEqual(
         ["Coffee"],
         [tag[0] for tag in return_list if tag[1] == "selected"])
     self.assertEqual(["tea"],
                      [tag[0] for tag in return_list if tag[1] == ""])
 def test_selected_tags(self):
     widget = LabelWidget()
     return_list = widget.tag_list(
         [t.name for t in self.article.tags.all()])
     self.assertEqual(
         ["Python"],
         [tag[0] for tag in return_list if tag[1] == 'selected'])
     self.assertEqual(["Django", "Advanced Computering"],
                      [tag[0] for tag in return_list if tag[1] == ''])
 def test_selected_tags(self):
     widget = LabelWidget()
     return_list = widget.tag_list([t.name for t in self.article.tags.all()])
     self.assertEqual(
         ["Python"], [tag[0] for tag in return_list if tag[1] == "selected"]
     )
     self.assertEqual(
         ["Django", "Advanced Computering"],
         [tag[0] for tag in return_list if tag[1] == ""],
     )
Example #5
0
 class Meta:
     model  = Post
     fields = '__all__'
     widgets = {
         'content': RedactorEditor(),
         'tags': LabelWidget()
     }
Example #6
0
class ProfileAdminForm(ModelForm):
    # tags = TagField(required=False, widget=LabelWidget)
    clusters = TagField(
        required=False,
        widget=LabelWidget(model=Cluster),
        help_text="Clusters the user wants to be included in",
    )
Example #7
0
class AgendaAdminForm(forms.ModelForm):
    contenido = forms.CharField(widget=TinyMCE(
        mce_attrs=customize_tinyMCE({
            'width': 980,
            'height': 600
        })))
    tags = TagField(required=False,
                    widget=LabelWidget(model=HierarchicalTag,
                                       hierarchical=True))
    localidad = TagField(required=False,
                         widget=LabelWidget(model=LocationTag,
                                            hierarchical=False))

    def __init__(self, *args, **kwargs):
        super(AgendaAdminForm, self).__init__(*args, **kwargs)
        init_gallerycon_settings()
Example #8
0
 class Meta:
     model = PUC
     fields = [
         "gen_cat", "prod_fam", "prod_type", "description", "tags", "kind"
     ]
     readonly_fields = ("num_products", )
     widgets = {"tags": LabelWidget(model=PUCTag)}
 def test_render_new(self):
     """Render method shouldn't error out with missing or string tags"""
     widget = LabelWidget(model=MyCustomTag)
     widget.render("tags", None, attrs={"id": u"id_tags"})
     widget.render("tags",
                   "'My Tag', 'Another tag'",
                   attrs={"id": u"id_tags"})
Example #10
0
 class Meta:
     model = PUC
     fields = [
         'gen_cat',
         'prod_fam',
         'prod_type',
         'description',
         'tags',
     ]
     readonly_fields = ('num_products', )
     widgets = {
         'tags': LabelWidget(model=PUCTag),
     }
Example #11
0
class PaginaAdminForm(forms.ModelForm):
    contenido = forms.CharField(
        required=False,
        widget=TinyMCE(mce_attrs=customize_tinyMCE({
            'width': 980,
            'height': 600
        })))
    tags = TagField(required=False,
                    widget=LabelWidget(model=HierarchicalTag,
                                       hierarchical=True))

    def __init__(self, *args, **kwargs):
        request = self.request
        super(PaginaAdminForm, self).__init__(*args, **kwargs)
        init_gallerycon_settings()
        if 'parent_id' in request.GET:
            self.fields['parent'].initial = Pagina.objects.get(
                pk=request.GET.get('parent_id'))
Example #12
0
class RecursoAdminForm(forms.ModelForm):
    descripcion = forms.CharField(
        required=False,
        widget=TinyMCE(mce_attrs=customize_tinyMCE({
            'width': 980,
            'height': 300
        })))
    contenido = forms.CharField(
        required=False,
        widget=TinyMCE(mce_attrs=customize_tinyMCE({
            'width': 980,
            'height': 800
        })))
    tags = TagField(required=False,
                    widget=LabelWidget(model=HierarchicalTag,
                                       hierarchical=True))

    def __init__(self, *args, **kwargs):
        super(RecursoAdminForm, self).__init__(*args, **kwargs)
        init_gallerycon_settings()
 def test_render_new(self):
     """Render method shouldn't error out with missing or string tags"""
     widget = LabelWidget(model=MyCustomTag)
     widget.render("tags", None, attrs={"id": u"id_tags"})
     widget.render("tags", "'My Tag', 'Another tag'", attrs={"id": u"id_tags"})
Example #14
0
 class Meta:
     model = ac_models.Hostingprovider
     fields = "__all__"
     widgets = {
         "services": LabelWidget(model=Tag),
     }
Example #15
0
class MultimediaAdminForm(forms.ModelForm):
    tags = TagField(required=False,
                    widget=LabelWidget(model=HierarchicalTag,
                                       hierarchical=True))
Example #16
0
class AdvertForm(ModelForm):
    tags = TagField(required=False,
                    widget=LabelWidget(model=models.HierarchicalTag))
Example #17
0
 class Meta:
     model   = Recipe
     fields  = '__all__'
     widgets = {
         'tags': LabelWidget()
     }
Example #18
0
 class Meta:
     widgets = {"tags": LabelWidget(model=ActionTags)}
Example #19
0
 class Meta:
     widgets = {"tags": LabelWidget(model=QuoteTags)}
 def test_initialization(self):
     customized_widget = LabelWidget(model=MyCustomTag)
     self.assertEqual(customized_widget.model, MyCustomTag)
     default_widget = LabelWidget()
     self.assertEqual(default_widget.model, Tag)