Snippet List
An example for using bootstrap theme for django-endless-pagination or django-el-pagination as asked on [http://stackoverflow.com/questions/30149152/how-to-set-bootstrap-theme-for-django-endless-pagination](http://stackoverflow.com/questions/30149152/how-to-set-bootstrap-theme-for-django-endless-pagination)
I used django-el-pagination to make it work on Django 1.9 and Bootstrap v4.0.0-alpha2, but same method should work on django-endless-pagination. For Bootstrap 3, you may consider removing extraneous classes in <li> and <a>.
- bootstrap
- django-endless-pagination
- django-el-pagination
An example for using bootstrap theme for django-el-pagination as asked on http://stackoverflow.com/questions/30149152/how-to-set-bootstrap-theme-for-django-endless-pagination
I used django-el-pagination to make it work on Django 1.9, but same method should work on django-endless-pagination as well.
- bootstrap
- django-endless-pagination
- django-el-pagination
If you require lots of forms in your project and do not want to be creating an extended template for each one I propose this solution.
Classes in the html correspond to bootstrap, you can work without them if you do not use bootstrap.
- template
- django
- dynamic
- fields
- forms
- generic
- generic-views
- html
- form
- bootstrap
- reusable
- custom
- modelform
- crud
- dynamic-form
Append span with text, image or other data to any django widget so bootstrap can format it like in [here](http://twitter.github.com/bootstrap/base-css.html#forms) (scroll to "Extending form controls" section)
Example usage:
`
example_field = CharField(
max_length=255, min_length=1,
label='Label', required=False,
widget=AppendWidget(base_widget=TextInput, data='@')
)
`
- django
- bootstrap
- append-input
Prepend span with text, image or other data to any django widget so bootstrap can format it like in [here](http://twitter.github.com/bootstrap/base-css.html#forms) (scroll to "Extending form controls" section)
Example usage:
`
example_field = CharField(
max_length=255, min_length=1,
label='Label', required=False,
widget=PrependWidget(base_widget=TextInput, data='@')
)
`
- django
- bootstrap
- prepend-input
You need jQuery and Bootstrap 2 and bootstrap-dropdown.js. Apart from that, this should be a perfect drop-in replacement for the normal select widget. A jQuery event callback maintains a hidden input field from the user's selection. Upon loading the page, the hidden input field is set.
The SelectWidgetBootstrap also contains a <noscript> tag containing the normal forms.Select widget.
Example usage:
class MyForm(forms.Form):
group = forms.ModelChoiceField(models.Group.objects.all(), widget=SelectWidgetBootstrap(),
empty_label=_(u'(no group selected)'))
- dropdown
- select
- bootstrap
Call this function as the first thing in your cron, or console script; it will bootstrap Django, and allow you to access all of the Django modules from the console, with out using 'python manage.py shell'
Examples:
# A script within your django project.
from django_bootstrap import bootstrap
bootstrap(__file__)
--- or ---
# A cron script located outside of your django project
from django_bootstrap import bootstrap
bootstrap("/path/to/your/project/root/")
- django
- console
- cron
- bootstrap
9 snippets posted so far.