1 2 3 4 5 | def get_default_sites():
return [site.id for site in Site.objects.all()]
class MyModel(models.Model):
sites = models.ManyToManyField(Site, default=get_default_sites)
|
More like this
- Configurable defaults for contrib.sites default Site during syncdb by chrischambers 8 months, 3 weeks ago
- ManyToManyFieldWithDefault by trbs 3 years, 11 months ago
- language switcher in admin by lawgon 2 years, 6 months ago
- Admin App/Model Custom Ordering by stephen_mcd 2 years, 3 months ago
- Bulk Insert - updated 5/9/2008 by coolie 4 years, 7 months ago
Comments