Re: Sites M2M field in Newforms Admin

2008-06-03 Thread Robvdl
I already figured it out, by following the Django source I came up with something like this to solve the problem: def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'sites': kwargs['initial'] = Site.objects.filter(pk=settings.SITE_ID) return s

Sites M2M field in Newforms Admin

2008-05-29 Thread Robvdl
I am in the middle of porting some code to the newforms admin branch. One of the fields in my models was as follows: sites = models.ManyToManyField(Site) ...where 'Site' is django.contrib.sites.models.Site Before switching to the newforms admin branch, if I created a new entry in admin, by defa