djangosnippets.org: Latest snippets tagged with 'bootstrap'https://djangosnippets.org/tags/bootstrap/2016-01-04T03:07:39.121362-06:00Bootstrap theme for django-endless-pagination?
2016-01-04T03:07:39.121362-06:00se210https://djangosnippets.org/snippets/10546/<p>An example for using bootstrap theme for django-endless-pagination or django-el-pagination as asked on <a href="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</a></p>
<p>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>.</p>
Freely redistributableBootstrap theme for django-endless-pagination?
2016-01-04T03:05:59.088815-06:00se210https://djangosnippets.org/snippets/10545/<p>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</p>
<p>I used django-el-pagination to make it work on Django 1.9, but same method should work on django-endless-pagination as well.</p>
Freely redistributableReusable form template with generic view
2015-12-02T08:02:40.154798-06:00roldandvghttps://djangosnippets.org/snippets/10541/<p>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.</p>
<p>Classes in the html correspond to bootstrap, you can work without them if you do not use bootstrap.</p>
Freely redistributableDjango Twitter Bootstrap 3 pagination
2014-02-02T12:27:50.522242-06:00Ragnar_Lodbrokhttps://djangosnippets.org/snippets/3023/<p>Twitter Bootstrap 3 default pagination with all pages indexes and controls for Django 1.6 ListView template.</p>
Freely redistributableboostrap append-input for widgets
2012-09-26T06:07:44.822288-05:00DimmuRhttps://djangosnippets.org/snippets/2827/<p>Append span with text, image or other data to any django widget so bootstrap can format it like in <a href="http://twitter.github.com/bootstrap/base-css.html#forms">here</a> (scroll to "Extending form controls" section)</p>
<p>Example usage:</p>
<p><code>example_field = CharField(
max_length=255, min_length=1,
label='Label', required=False,
widget=AppendWidget(base_widget=TextInput, data='@')
)</code></p>
Freely redistributableboostrap prepend-input for widgets
2012-09-26T06:00:01.689076-05:00DimmuRhttps://djangosnippets.org/snippets/2826/<p>Prepend span with text, image or other data to any django widget so bootstrap can format it like in <a href="http://twitter.github.com/bootstrap/base-css.html#forms">here</a> (scroll to "Extending form controls" section)</p>
<p>Example usage:</p>
<p><code>example_field = CharField(
max_length=255, min_length=1,
label='Label', required=False,
widget=PrependWidget(base_widget=TextInput, data='@')
)</code></p>
Freely redistributableBootstrap button dropdown widget (replaces forms.Select)
2012-08-01T08:34:29.546113-05:00benjaominghttps://djangosnippets.org/snippets/2797/<p>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.</p>
<p>The SelectWidgetBootstrap also contains …</p>
Freely redistributableCustom Form Example: Forms for Bootstrap Html - CSS Toolkit
2011-12-16T04:29:38.036646-06:00fatiheriklihttps://djangosnippets.org/snippets/2631/<p>Improved for BootStrap
details: http://twitter.github.com/bootstrap/</p>
<p>Using:</p>
<p>class AnyForm(forms.Form, CustomForm):
pass</p>
<p>Template:</p>
<p><form>
{{ form.render_errors }}
{{ form.as_div }}
</form></p>
Freely redistributablecron/console bootstrap django
2007-08-19T00:48:31.725147-05:00nstritehttps://djangosnippets.org/snippets/374/<p>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'</p>
<pre><code>Examples:
# A script within your django project.
from django_bootstrap import bootstrap
bootstrap(__file__)
--- …</code></pre>
Freely redistributable