GithubHelp home page GithubHelp logo

django-bootstrap-toolkit's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m Dylan (he/him).
  • ๐Ÿ‡ณ๐Ÿ‡ฑ I live in The Netherlands.
  • ๐Ÿ‘€ Iโ€™m interested in software development, biology, music, philosophy, volleyball.
  • ๐ŸŒฑ Iโ€™m currently learning to be better at lots of things.
  • ๐Ÿ”— I'm on Twitter as @dyve

django-bootstrap-toolkit's People

Contributors

aflx avatar conrado avatar dyve avatar fengsi avatar gabejackson avatar kov avatar luzfcb avatar madjar avatar martinth avatar njheath avatar petry avatar phughes avatar samdolan avatar zokis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-bootstrap-toolkit's Issues

Serving js and css file from local machine

Congratulations for this amazing work. But my concern is about serving all css and js files on local server instead of over internet. It might be interesting for some web applications where the server may not permitted access to internet.
I've tried

BOOTSTRAP_BASE_URL = STATIC_ROOT + 'bootstrap/' with no luck.

Datepicker: append a button instead a <i>

Hello Dyve, the BootstrapDateInput appends a <i class='icon-calendar'>

While is clear to us devs that it isn't a button, final users tend to click on it and nothing happens. Putting a button in place and making this button activate datepicker solve the problem.

Python 3 import

Duplicate for #71 because I made typo in commit statement. For future reference.

custom attrs passed to a widget are ignored when using RadioSelect

When using a standard RadioSelect widget with custom attrs like:

widget = forms.RadioSelect(attrs = {'data-control-jqgridselector': self.add_prefix(fname)})

these attrs are being ignored.

I believe it's due to the way choice fields are handled in field_choices.html template - this code takes no custom attributes into account.

rtl version

is there aversion to support right to left languages

CheckboxSelectMultiple rendering gets confused on similar choice inputs

Wrong checkboxes are rendered with the 'checked' attribute in the following scenario:

CHOICES = (
    ...
    (3, '...'),
    ...
    (33, '...'),
)

and

the_field = MultipleChoiceField(choices=CHOICES,
    widget=CheckboxSelectMultiple())

If the form is submitted with 33 checked, then the rendering of this widget will also display 3 as checked. The actual QueryDict is not altered (only 33 is obtained from getlist).

On a very quick search, I believe the problem may be with:

{% if type == "checkbox" %}{% if choice_id|safe in field.value|safe %} checked{% endif %}

since, indeed, 3 is 'in' 33.

A workaround is to use values for CHOICES which do not 'confuse' the rendering logic, such as values which do not share substrings.

A lot of empty lines in forms rendering

It's not a big deal, but app add a lot of empty lines in HTML

Form
class AuthorBidForm(forms.Form):
    description = forms.CharField(widget=forms.Textarea)
    watchperday = forms.IntegerField()
    website = forms.URLField()
    contacts = forms.CharField(max_length=500)
Template
<form method="POST" action="/author/save">
            {% csrf_token %}
            <fieldset>
                {{ form|as_bootstrap }}
                <button type="submit" class="btn btn-success btn-large">ะžั‚ะฟั€ะฐะฒะธั‚ัŒ</button>
            </fieldset>
        </form>
Rendering result
  <form method="POST" action="/author/save">
            <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='...' /></div>
            <fieldset>















                <div class="control-group required">



                <label class="control-label" for="id_description">Description</label>
                <div class="controls">



        <textarea id="id_description" rows="10" cols="40" name="description"></textarea>

Invalid date format

The datepicker creates dates in the format dd-mm-yyyy, but django complains it's invalid. dd.mm.yyyy works

Support InlineFormset

This awesome django toolkit should support the InlineFormset, to be able to do:
{{myinlineformset|as_bootstrap}}

No label for multicheckbox inputs

Multicheckbox inputs should have a label added for the overall group, something like this in field_vertical.html:

{% if input_type == "multicheckbox" %}
    <label{% if field.required %} class="required"{% endif %}>{{ field.label }}</label>
    {% include "bootstrap_toolkit/field_choices.html" with type="checkbox" %}
    {% include "bootstrap_toolkit/field_help.html" with inline=False %}
    {% include "bootstrap_toolkit/field_errors.html" with inline=False %}

Overriding input_type

templatetags/bootstrap_toolkit.py:125

@register.filter
def bootstrap_input_type(field):
    """
Return input type to use for field
"""
    try:
        widget = field.field.widget
    except:
        raise ValueError("Expected a Field, got a %s" % type(field))
    input_type = getattr(widget.attrs, 'bootstrap_input_type', None)

input_type is always None at this point. There is no way to override this property. Maybe you should use get on attrs dict?

should field_errors.html be included before field_help.html?

With current implementation, in horizontal form, field error message is rendered after field help. By default the help message is block, thus it causes the error message to be rendered as a new line under the help info. What I want is to display the error message at the right of a field, and help message under the field.

The "inline" in template seems to controls help layout (inline or block), as well as error (opposite to help), however in either case the help is always rendered before error.

I know I can change the rendering order in template, but still I was wondering if there is a better way to take care of it automatically, for both cases. Say if help is block and error is inline, the field error message should then be rendered before help. On the other hand, if help is inline and error is block, then help is rendered first.

Now the "inline" is hard-coded in template based on form style. It would be great if there is a way to gain more control over it (but not too much complication).

pagination filter issue

pagination template filters should switch to a templatetag, so we will be able to pass context vars to the template rendering method. just imagine to add pagination to a page that is using custom url params (i.e. ?page=2&param1=foo&param2=bar), actually this is not possible!

modelform not work

When use modelform, there is an exception: Caught ValueError while rendering: Expected a Field, got a <type 'str'>

Not working with formsets

I have been able to do a work around (by looping) but figured a nice feature would be to be able to do something like:

{{ formset|as_bootstrap }}

The management_form would need to get rendered as well as that is the normal expectation of:

{{ formset }}

Perhaps you could also make this work too:

{{ formset.management_form }}
{{ formset.forms|as_bootstrap }}

Thanks!

Bootstrap toolkit not picked up

I have followed the tutorial with installation being successful, i have made sure i have bootstrap in my installed_Apps but wherever i reference the {% load bootstrap_toolkit %} tag. i can see in my logs that the .css file does not get referenced nor in firebug chrome inspector. There are no errors yet none of the bootstrap .class files work.

For example i want to use the span css style for a div and nothing works.

https urls by request?

would like to have {% bootstrap_javascript_tag %} and the styles tag be https by request

The template for the help_text should include the 'safe' filter

Django's default form templates, such as as_p, as_ul and as_table, mark the help_text as 'safe', so you can use HTML in your help_text.

This behavior is broken when adopting bootstrap-toolkit.

I suggest adding '|safe' to the help_text in templates/field_help.html

Disabled form elements

When setting a form field of type ChoiceField to readonly the generated form field is in a wrong state.

Example of currently generated select field:

<select readonly="True" name="groupType" id="id_groupType">
  <option value="Primary">Primary</option>
  <option value="Secondary" selected="selected">Secondary</option>
</select>

which should be changed into:

<select readonly="True" name="groupType" id="id_groupType" disabled>
  <option value="Primary">Primary</option>
  <option value="Secondary" selected="selected">Secondary</option>
</select>

to include the "disabled" tag.

'{% include "..." with inline=True %}' does not what it's supposed to do

I just tried to create a form with a single checkbox and an inline help_text next to it, like this:

[x] This is the help_text

As I understood bootstrap_toolkit a tried the following:

{{ my_form.thefield|as_bootstrap:'inline' }}

However, this didn't work like I expected, instead I got this result:

[x]
This is the help_text

Getting curious, I look in the source for field_inline.html and saw {% include "bootstrap_toolkit/field_help.html" with inline=True %} and in the field_help.html template I found the {% if inline %} condition with an <span class="help-inline"> in the body of it. Checking with the bootstrap documentation this is the correct class for an inline help_text directly next to a field. Putting some additional text within the true- and false-branch of the condition I discovered that, the true-branch is never run.

At first, this made no sense to me. After all, the template is included with inline=True so inline should be true, or shouldn't it? As it turns out, no! Turns out that True is not a literal in the Django template syntax. Instead True is resolved as a variable for the current context where it (most likely) doesn't exist so TEMPLATE_STRING_IF_INVALID is outputted. TEMPLATE_STRING_IF_INVALID in turn defaults to an empty string and an empty string is false. So even if you pass inline=True inline is actually false.

In short: It's currently not possible to format fields with 'help-inline' class because the code is not reachable.

Bootstrap bundles included and made easy

I think it would be pretty great if the package would include the original Twitter Bootstrap source code and would be simply configurable to use django_assets or similar assets manager to create and minify bundles of CSS/LESS files automatically.

Extraneous `.DS_Store` files installed

bootstrap_toolkit$ find . -name .DS_Store
./static/datepicker/.DS_Store
./static/.DS_Store

Maybe adding a

recursive-exclude * .DS_Store

line to MANIFEST.in could help?

Placeholders?

This would be a feature request: why not creating a mechanism for displaying field placeholders? For example, if the developer sets something like "BOOTSTRAP_TOOLKIT_PLACEHOLDERS = True" in the settings, the toolkit puts them in the fields.

Example / Demo

Please host an online example of the capabilities of this toolkit!

Love it!

More flexible "bootstrap_stylesheet_tag"

First of all, thank you for this cool package.

Now, we all know the {% bootstrap_stylesheet_tag %} template tag which renders <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">

But what if you want to use the responsive bootstrap css, i.e. <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css">? You have to manually include it in the html head.

What do you think about extending the template tag to accept an optional parameter (i.e. "bootstrap-responsive.css")?

Checkbox label text repeated

Hi,

small thing - when showing forms w. checkboxes and using the form in a template doing the normal django-all-the-way stuff a checkbox field shows the label and the checkbox. Now, when I use the 'as_bootstrap' filter I get the label text repeated next to the checkbox.

{{ form }} --> text box

{{ form | as_bootstrap }} --> text box text

Anyway to get around this? or perhaps would make sense to ensure same behavioral as with default django forms.

Thanks for great code, saves me tons of time !!!!

/ Jens

Upload Files

Hello, have any methods beautiful with django bootstrap_toolkit for upload files?

multi line textarea?

As the demo project seems not to use a multi line textarea I am wondering how this could be achieved?

duplicate: bootstrap css not loading

When I load the demo project, the css does not load. The bootstrap url gets 404 response.

Edit: Didn't bother to check the closed issues. sorry. please close.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.