MultiValueDictKeyError at /add - django

Each time I add Project with Expense Category. It's displaying error in the browser
MultiValueDictKeyError at /add 'categoriesString'
Although the Project is getting saved in the database!
Please help me to figure it out!

in the form's html field put name="categoriesString" for the input field where you are passing data

Related

I have 2 forms on the same page that uses django-recaptcha ReCaptchaV2Invisible, when I submit the "2nd" form the "1st form is submitted instead

Hi I have two forms on my home page, the one is a "contact form" and the other one is a "subscribe to mail list form". I used the "django-recaptcha ReCaptchaV2Invisible" field on both forms. The contact form works fine, but if I submit the second form (the mail list one) the first form is submitted and I get and invalid form error (obviously).
Has anyone experience the same problem? any recommended fixes?
Thanks

How can I delete user made by django rest_auth in admin page

I made a user using rest_auth. And I want to delete those users from the django_admin page. But when I try to delete it, the following error occurs.
OperationalError at /admin/auth/user/ no such table: allauth_socialaccount
Through the search, I got results to put 'allauth.socialaccount' in INSTALLED_APPS, but this didn't help me. how can I solve it ?

Getting |as_crispy_field got passed an invalid or inexistent field

Im using crispy field on inputs for css speed.
I have my {{from.username|as_crispy_field}}.
When i submit the data i get a CrispyError at /client error.
Exception Type: CrispyError
Exception Value:
|as_crispy_field got passed an invalid or inexistent field
What do i need to do to handle this in views ?
it is supposed to be {{form.username|as_crispy_field}} instead of {{from.username|as_crispy_field}}.
PS. This is about 3 years old but I hope the answer will help someone at some point. Cheers!

django formset not working properly after removing few forms

I'm using a django formset having 5 forms. After entering data and posting them to my. I validate the formset and save the valid forms(suppose 2 are saved) and remove them from formset and unvalidated forms(3 in this case) are rendered back on django template. Now, after correcting the data on these 3 forms, I post them again.
Now in my view, I'm getting 5 forms again
and 2 forms which were saved earlier are posted with empty data.. because of which my
formset.is_valid()
returns false and error is raised.
Can anybody tell me the reason why this is happening and how to fix it?
Thanks in advance!
EDIT: I have found out that issue is because form-TOTAL_FORMS and form-INITIAL_FORMS are still not same ater removing forms. Any quick help to update these numbers?

Pagination with a POST

I have a field where a user can search in. The user selects an option, then that is posted to a view and returns him with the Filtered results on a new page.
Im not sure how I would paginate this because the data this must be displayed is filtered by the previous post?
To paginate the first one is fine, cause tou have the post and know what to return to the page. But what about page 2 etc? then the post is gone?
Use hidden HTML input fields to keep track values posted from previous post