djangosnippets.org: Latest snippets tagged with 'many'http://djangosnippets.org/tags/many/2008-06-01T13:18:30.959528-05:00ManyToManyFieldWithDefault
2008-06-01T13:18:30.959528-05:00trbshttp://djangosnippets.org/snippets/780/<p>Extension to the normal ManyToManyField to support default values.</p>
<p>Build for the following use case:</p>
<p>publish_on = ManyToManyFieldWithDefault(Site, verbose_name=_('publish on'), default=Site.objects.get_current)</p>
<p>Where with a plain ManyToManyField the default site will not be selected. The ManyToManyFieldWithDefault fixes this by automatically selecting the default value if no other selections are given.</p>
<p>When …</p>
Freely redistributable