djangosnippets.org: Latest snippets tagged with 'fieldsets'https://djangosnippets.org/tags/fieldsets/2010-05-26T16:53:42.284344-05:00FieldStack - easy form template rendering
2010-05-26T16:53:42.284344-05:00divermanhttps://djangosnippets.org/snippets/2040/<p>FieldStack simplifies forms template rendering. This is enhanced version of snippet <a href="http://djangosnippets.org/snippets/1786/">1786</a></p>
Freely redistributableForm field sets
2010-01-21T09:47:44.565908-06:00gonzhttps://djangosnippets.org/snippets/1878/<p>Create form atribute(s) for grouping (bound) fields.</p>
Freely redistributableRemove named field from fieldsets
2009-11-17T06:11:54.306996-06:00dokterbobhttps://djangosnippets.org/snippets/1803/<p>This snipped removes a specific fields from the fieldsets. This is very useful to leave a field 'out' in the admin, likewise:
</p>
<pre><code>def get_fieldsets(self, request, obj=None):
fieldsets = super(BlaModelAdmin, self).get_fieldsets(request, obj)
if not request.user.has_perm('change_blah'):
remove_from_fieldsets(fieldsets, ('blah',))
</code></pre>
Freely redistributableStacked/Grouped Forms 2 - easy rendering forms
2009-11-09T17:32:04.586247-06:00divermanhttps://djangosnippets.org/snippets/1786/<p>This snippet was inspired by <a href="http://www.djangosnippets.org/snippets/1783/">1783</a>. It allows simply create groups of fields for template rendering.</p>
Freely redistributableDRY Fieldsets
2009-06-11T06:24:14.028458-05:00DrMeershttps://djangosnippets.org/snippets/1563/<p>I've devised a DRY method of declaring django fieldsets:
</p>
<p><strong> Example usage: </strong>
</p>
<ol>
<li><p>Include the attached code in <code>fieldsets.py</code>
</p>
</li>
<li><p><code>models.py</code>:
</p>
<pre><code>from django.db import models
from fieldsets import Fieldset, ModelWithFieldsets
class Person(ModelWithFieldsets): #instead of models.Model
# this field will be placed in nameless fieldset
example_field = models.IntegerField()
# this fieldset will be …</code></pre></li></ol>
Freely redistributableForms splitted in fieldsets
2008-03-25T12:31:29.984102-05:00gustavo80brhttps://djangosnippets.org/snippets/663/<p>This template tag build a Form splitted in fieldsets. The fieldsets are configured with a second parameter, that is a tuple like the one used in the Admin class in models in the attribute "fields".</p>
<p>You pass to the template the form and the tuple and than use them as …</p>
Freely redistributable