How to create new titles for authors using inlineformset factory by selecting authors created by logged in users only.
Models.Py
Model1 user=models.ForeignKey(settings.AUTH_USER_MODEL) Author = models.CharField(max_length=100) Model2 Author_for_title=models.ForeignKey(Model1) title=models.CharField(max_length=100) Now i want to have a form where users can select the Author and type title in input field to update.
So far everything is fine. But only thing i am not able to solve is that:
How to use queryset so that Author select field display authors created by logged in Users only?
formset=inlineformset_factory(Model1,Model2,,can_delete=True,fields=('__all__',),extra=3) I found no answer anywhere, please help with an example.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/afad4bdf-275d-4ff2-ad2f-4422be9056d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment