0👍
✅
When instantiating the modelForm
I wasn’t passing the instance of BlogNotifications
model to it. So in the view the form set up looks like:
blogForm = BlogNotificationsForm(instance=BlogNotifications.objects.get(user=request.user))
I hope this may help someone in the future, it really wasn’t that clear in the docs to me!!
1👍
In the view maybe you can set the queryset like this:
form = BlogNotificationsForm()
form.fields["categories"].queryset = Categories.objects.all()
I found this example here
- [Django]-How can I use RESTful services with Django + Mongoengine?
- [Django]-Django user in tornado
- [Django]-Getting task_ids for all tasks created with celery chord
- [Django]-Formatting Time Django Template
- [Django]-Force re-collectstatic with django static?
Source:stackexchange.com