class Report(models.Model):
precursor = models.ManyToManyField(Precursor)
class ReportAdmin(admin.ModelAdmin):
def formfield_for_manytomany(self, db_field, request, **kwargs):
ops_area = Report.objects.get(id=???????).ops_area
print id
print ops_area
if db_field.name == "r_precursor":
kwargs["queryset"] = Precursor.objects.filter(ops_area=ops_area)
print kwargs
return super(ReportAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
How can I give def formfield_for_manytomany
an id of editable object?