viewflow / django-material

Material Design for Django
http://viewflow.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 425 forks source link

forms.MultipleChoiceField do no materializing #80

Closed voronind closed 8 years ago

voronind commented 8 years ago

forms.MultipleChoiceField has no materialized implementation. It's standard widget. Django 1.9.2 django-material 0.5.1

kmmbvnr commented 8 years ago

That's not true

http://forms.viewflow.io/demo/widget/multiplechoice/

voronind commented 8 years ago

It's good with widget=forms.CheckboxSelectMultiple, but no changes without widget specification.

kmmbvnr commented 8 years ago

Have you missed to include jquery before includes/material_js.html?

voronind commented 8 years ago

No. I use Python 3

voronind commented 8 years ago

I tried your example code and got the same.

My code render result of {% form %}{% ednform %}:

<div class="row">
    <div id="id_languages_container" class="select-field col s12 required multiselect">
        <label for="id_languages" class="">Язык</label> <select class="material-ignore" name="languages" id="id_languages" multiple="">
            <option value="**">Не зависит </option>

        <option value="EN">Английский </option>

        <option value="RU">Русский </option>

        <option value="DE">Немецкий </option>
        </select>
    </div>
</div>
<div class="row">
    <div id="id_languages_container" class="select-field col s12 required multiselect">
        <label for="id_languages" class="">Язык</label> <select class="material-ignore" name="languages" id="id_languages" multiple="">
            <option value="**">Не зависит </option>

        <option value="EN">Английский </option>

        <option value="RU">Русский </option>

        <option value="DE">Немецкий </option>
        </select>
    </div>
</div>
kmmbvnr commented 8 years ago

You should check javascript errors in the browser console

kmmbvnr commented 8 years ago

class="material-ignore" lol, are you about admin part? This is not `MultipleChoiceField

voronind commented 8 years ago

No. It's my FormView with your example form or my form. Result is the same. Default multiple select widget if field = forms.MultipleChoiceField(..., widget=forms.SelectMultiple)

2016-02-19 13:54 GMT+03:00 Mikhail Podgurskiy notifications@github.com:

* class="material-ignore"* lol, are you about admin part? This is not MultipleChoiceField

— Reply to this email directly or view it on GitHub https://github.com/viewflow/django-material/issues/80#issuecomment-186170196 .

kmmbvnr commented 8 years ago

I have no idea, what's wrong with you code.

You copy-pasted the html that could be rendered only from django_filteredselectmultiple.html That's the admin part.

voronind commented 8 years ago

I don't include material.admin to INSTALLED_APPS even.

templates/material/fields/django_selectmultiple.html content:

{% load material_form material_form_internal %}

{% render bound_field template='fields/django_select.html' %}
    {% part field add_control_attr %}multiple{% endpart %}
    {% part field add_group_class %}multiselect{% endpart %}
    {% part field add_control_class %}material-ignore{% endpart %}
    {% part field options %}
        {% for value, choice in field.widget.choices %}
        <option {% if value in bound_field.value %}selected="selected"{% endif %}
                {% if value == None or value == '' %}style="display:none"{% endif %}
                value="{{ value|default_if_none:"" }}" >{% if value == None or value == '' %}{{ form_select_empty_label|default:choice }}{% else %}{{ choice }}{% endif %} </option>
        {% endfor %}
    {% endpart %}
{% endrender %}
kmmbvnr commented 8 years ago

That's not true - https://github.com/viewflow/django-material/blob/master/material/templates/material/fields/django_selectmultiple.html

voronind commented 8 years ago

I use last release 0.5.1

2016-02-19 15:02 GMT+03:00 Mikhail Podgurskiy notifications@github.com:

That's not true - https://github.com/viewflow/django-material/blob/master/material/templates/material/fields/django_selectmultiple.html

— Reply to this email directly or view it on GitHub https://github.com/viewflow/django-material/issues/80#issuecomment-186189087 .

kmmbvnr commented 8 years ago

You should use git version, before posting issue requests

voronind commented 8 years ago

I tried. Master is broken.

Invalid filter: 'select_options'
In template /home/dima/.virtualenvs/mathtrade/lib/python3.4/site-packages/material/templates/material/fields/django_select.html, error at line 18
kmmbvnr commented 8 years ago

How did you get the error? Did you grab the whole code or just html template?

voronind commented 8 years ago

It's DEBUG=True output. I installed master version.

2016-02-19 15:17 GMT+03:00 Mikhail Podgurskiy notifications@github.com:

And how did you get the error? Did you grab the whole code or just html template?

— Reply to this email directly or view it on GitHub https://github.com/viewflow/django-material/issues/80#issuecomment-186194079 .

kmmbvnr commented 8 years ago

I have no such error.

voronind commented 8 years ago

It's OK now

2016-02-19 15:24 GMT+03:00 Mikhail Podgurskiy notifications@github.com:

I have no such error.

— Reply to this email directly or view it on GitHub https://github.com/viewflow/django-material/issues/80#issuecomment-186196731 .