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
- Creator/updater fields for admin by baumer1122 4 years, 10 months ago
- Bulk Insert - updated 5/9/2008 by coolie 5 years, 7 months ago
- Limit ManyToMany fields in forms by jedie 3 years, 9 months ago
- Add delete buttons to admin changelist by kylefox 6 years ago
- Admin App/Model Custom Ordering by stephen_mcd 3 years, 3 months ago
Comments