Django form model with many built-in

I would like to store page groups under different tags. Therefore, I create these models:

class Page(models.Model): title = models.CharField(max_length=50) class Tag(models.Model): title = models.CharField(max_length=50) pages = models.ManyToManyField(Page) 

I would like to create a model form (set?) That will allow me to edit the tag and each page attached to this tag as one large form. I believe this is what happens when you use Model Inline Formset, but use foreign keys. This is a reusable application, right now I'm just presenting the form in a template, but I would prefer using django forms to make reuse easier.

I can’t understand how this is done, any suggestions will be very grateful.

+4
source share
1 answer

I also had the same problem, but I used a general attitude, please examine my link for communication below. U can use the built-in set of forms in the same way. If you have another problem, you can come back to me.

< Creating a form using Generic_inlineformset_factory from a model form >

+2
source

Source: https://habr.com/ru/post/1335943/


All Articles