Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have problems with editing in row edit of the table template #10

Open
djole988 opened this issue May 6, 2023 · 0 comments
Open

I have problems with editing in row edit of the table template #10

djole988 opened this issue May 6, 2023 · 0 comments

Comments

@djole988
Copy link

djole988 commented May 6, 2023

When i reconfigure, list.html, edit_row.html change pattern urls, views, models, etc. I got in situation, that everithing is working, but when i double click on the row it opens prefiled fields, cancel button is working, but when i hit save button in edit_row.html i get error. I tried to find the error but i cannot find it. Can anyone help me with this?

the error:

Request body: b'task_id=3046.002&task_name=Djorjde&creation_date=2023-05-09&realization_date=2023-06-01&status=Ongoing&task_id=&task_name=&creation_date=&realization_date=&status='
Form data: <QueryDict: {'task_id': ['3046.002', ''], 'task_name': ['Djorjde', ''], 'creation_date': ['2023-05-09', ''], 'realization_date': ['2023-06-01', ''], 'status': ['Ongoing', '']}>
Form errors:

  • task_id
    • This field is required.
  • task_name
    • This field is required.
  • creation_date
      This field is required.
  • realization_date
    • This field is required.
  • status
    • This field is required.

this is from console after i put some debug console logs in views.py

....

def update_instance(self, request, pk, is_urlencode=False):
task = self.get_object(pk)
form_data = QueryDict(request.body) if is_urlencode else request.POST

    print("Request body:", request.body)  
    print("Form data:", form_data)  

    form = TaskForm(form_data, instance=task)
    # print(form_data)

    if form.is_valid():
        form.save()
        if not is_urlencode:
            messages.success(request, 'Transaction saved successfully')

        return True, 'Transaction saved successfully'
    else:
        print("Form errors:", form.errors) 

    if not is_urlencode:
        messages.warning(request, 'Error Occurred. Please try again.')
    return False, 'Error Occurred. Please try again.'

Everithing else is functioning, like edit button in row of volt in drop down and saving changes etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant