Default to current/all sites in admin (updated!)

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

  1. Configurable defaults for contrib.sites default Site during syncdb by chrischambers 8 months, 3 weeks ago
  2. ManyToManyFieldWithDefault by trbs 3 years, 11 months ago
  3. language switcher in admin by lawgon 2 years, 6 months ago
  4. Admin App/Model Custom Ordering by stephen_mcd 2 years, 3 months ago
  5. Bulk Insert - updated 5/9/2008 by coolie 4 years, 7 months ago

Comments

(Forgotten your password?)