Hello, I am trying to save a many to many relation that has custom information passed to it before the form loads in the admin. The first part of this works great where the form only loads the data I want it to show, however when I try to click the little plus sign to add a new entry from the admin and save it, the form won't submit and I receive this error:
"Select a valid choice. 149 is not one of the available choices." The 149 is the id of the new image placement I just created and added to the many to many field for an article. It's like it didn't register with the article admin that a new one was added. If I remove the override of formfield_for_manytomany, it works but it loads a bunch of data I don't want it to. Here is my formfield_for_manyttomany function override. Any idea what the problem might be? Thanks def formfield_for_manytomany(self, db_field, request, **kwargs): if db_field.name == "image_placements": try: article_id = 10 #hard coded for simplicity article = ArticleBase.objects.get(id=article_id) image_placements = article.image_placements.all() kwargs["queryset"] = image_placements return db_field.formfield(**kwargs) return super(ArticleAdminBase, self).formfield_for_manytomany(db_field, request, **kwargs) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.