Code Monkey home page Code Monkey logo

django-bootstrap's People

Contributors

bouke avatar bradwhittington avatar coderanger avatar earle avatar fengsi avatar gikrauss avatar jianli avatar jodal avatar jterrace avatar leewardbound avatar matthewryder avatar mikery avatar nivl avatar pthrasher avatar saschpe avatar schwuk avatar sergey-stukov avatar stard0g avatar twoolie avatar vibrant avatar vicalloy 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

django-bootstrap's Issues

Fieldset

class Meta:
layout = (
Fieldset("Please Login", "username", "password", ),
)
when i try to add a Fieldset as in the readme i get an error 'name 'Fieldset' is not defined' i am sure i am doing some noob mistake and not importing some thing but i am not sure what and google does not seem to have any results on why it does not work

Could not resolve form field forms.HiddenInput

Hello!

I can't use forms.HiddenInput() in Form Class:

class MyForm(BootstrapModelForm):
    hidden_field = forms.HiddenInput()
Exception Value:    

Caught NoSuchFormField while rendering: Could not resolve form field 'is_save_only'.

Exception Location:     /home/daniel/.virtualenvs/load_tester/src/bootstrap/bootstrap/forms.py in render_field, line 82

Thanks.

Adding templatetags support?

I've been using django-uni-form in the past. It can be used both in forms.py and as templatetag in a template.

The reason for templatetags support is simple: it's easy to write your own forms based on BootstrapForm/BootstrapModalForm/etc, however when you are using 3rd-party apps, replacing ALL forms.Form with BootstrapForm in source files would not be a good idea.

Actually there is another Django app which provides a simple templatetag "as_bootstrap" to convert Django standard form output to bootstrap style:
https://github.com/dyve/django-bootstrap-toolkit

It worked well until bootstrap upgraded to 2.0.0. It doesn't have fieldset support though (due to the nature of templatetags).

Both methods have their own advantage: in forms you have more control (like fieldset support, which is also provided in django-uni-form), and in templatetag you can simply convert standard forms used by 3rd-party apps to bootstrap style.

So I was wondering if you can add templatetags support in django-bootstrap? Probably a similar "as_bootstrap" templatetag.

Thanks.

Compatability with ModelForms?

Hi,

I was curious whether you had any plans for compatibility with Django ModelForms?

E.g. I'm using the new class-based CreateView, and I'm not sure how I would go about hooking django-boostrap into my forms?

Cheers,
Victor

Incorrect fieldset legend if value is django.utils.translation.ugettext_lazy

Fix:

diff --git a/bootstrap/forms.py b/bootstrap/forms.py
index 988e5e4..7c3f4a7 100755
--- a/bootstrap/forms.py
+++ b/bootstrap/forms.py
@@ -160,11 +160,11 @@ class Fieldset(object):
     """ Fieldset container. Renders to a <fieldset>. """

     def __init__(self, legend, *fields, **kwargs):
-        self.legend_html = legend and ('<legend>%s</legend>' % legend) or ''
+        self.legend_html = legend and legend or ''
         self.fields = fields
         self.css_class = kwargs.get('css_class')

     def as_html(self, form):
         class_str = self.css_class and (' class="%s"' % self.css_class) or ''
-        return u'<fieldset%s>%s%s</fieldset>' %  (class_str, self.legend_html, form.render_fields(self.fields), )
+        return u'<fieldset%s><legend>%s</legend>%s</fieldset>' %  (class_str, unicode(self.legend_html), form.render_fields(self.fields), )

Can't create form from instance -- "got an unexpected keyword argument 'instance'"

When attempting to initialise a form from an existing Model, I get the error "got an unexpected keyword argument 'instance'". Is it expected to be able to initialise a form object in this way?

From my views.py:

class MyForm(BootstrapForm):
    class Meta:
        model = MyModel

def process_request(request, brew_id):
    if request.method == 'POST':
        form = MyForm(request.POST)
    else:
        model = get_object_or_404(MyModel, pk=brew_id)
        form = MyForm(instance=model)

Change name to something more explicit

Just a suggestion but django-bootstrap could mean:

  • A bootstrap Django project
  • A set of templates for Twitter bootstrap
  • A form library for twitter bootstrap :)

Perhaps something like django-bootstrap-forms?

Broken on Django 1.6

bootstrap.forms in render_field
AttributeError: 'BoundField' object has no attribute '_auto_id'

'Fieldset' object is not iterable

Hi, I've been given an error:

Exception Value:
'Fieldset' object is not iterable

I did just like "Usage" showed, but no success.

Does anyone know about this?

Thanks.

inline forms

hi is their way to get the forms to render inline ?

Remove label?

Is it possible to remove the label beside the input field?

Fieldset Close Tag

Fieldsets are being closed at the wrong place. This is what I'm seeing generated:

<form ...>
        <fieldset><legend>Details</legend></fieldset>
        <div class="control-group">...</div>
</form>

Bootstrap documentation shows examples with this format instead:

<form ...>
        <fieldset>
        <legend>Details</legend>
        <div class="control-group">...</div>
        </fieldset>
</form>

This is causing some weird spacing issues with Bootstrap 2.0.1 and django-bootstrap from the latest master.

Saving doesn't work

It seems that instances of classes subclassed from BootstrapForm don't have a save method. As a result, it's not possible to save those forms.

Django-bootstrap working with SessionWizardView (dev)

Hello,
I've try django-bootstrap working with SessionWizardView and my first step form is empty. Not really empty because the hidden field <input type="hidden" name="inscription_wizard-current_step" value="0" id="id_inscription_wizard-current_step" /> is in the html source of the rendered page.

But others fields are not. I'm not enough django proof to find a solution but of course I agree testing.

It would be really great I think if the both can work together.

here is my code:

forms.py


class Step1Form(BootstrapForm):

class Meta:
layout = (
Fieldset("Please Login", "email_adresse", "telephone", ),
)

email_adresse = forms.EmailField(max_length=255)
telephone = FRPhoneNumberField(required=False)```


views.py
```class InscriptionWizard(SessionWizardView):

def get_template_names(self):
return 'clients/session_wizard.html'```


and html:

```
<form action="." method="post">{% csrf_token %}

    {{ wizard.management_form }}

    {% if wizard.form.forms %}
        {{ wizard.form.management_form }}
        {% for form in wizard.form.forms %}
            {{ form }}
        {% endfor %}
    {% else %}
        {{ form }}
    {% endif %}

    <input type="submit">
</form>
{% endblock %}
```

If you have any idea ... let me jnow.

Best regards an thanks a lots for the job.

Alain

QueryDict instance loses data when using prefix?

I have a form where I want to use two BootstrapModelForm instances. When unpacking the data from these on postback using the prefix parameter I get the following error:

'QueryDict' object has no attribute '_meta'

I am using the regular "prefix" attribute to specify the form output prefix like this:

user_form = UserForm(instance=request.POST, prefix="user")

The error occurs when Bootstrap is setting up the ModelForm object on line 149:

class BootstrapModelForm(forms.ModelForm, BootstrapMixin):
    def __init__(self, *args, **kwargs):
        forms.ModelForm.__init__(self, *args, **kwargs)

Has django-bootstrap stripped some data along the way?

inline forms

hi is their way to get the forms to render inline ?

Custom ID to the div's of each field

Is is possible to allow the addition of a custom id to a field such that it looks something like this:

<div id="div_paypal_email" class="control-group">
    <label class="control-label">Paypal Email</label>
    <div class="controls">
        <input id="id_paypal_email" type="text" name="paypal_email" value="" maxlength="75">
        <p class="help-block"></p>
    </div> 
</div>

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.