-
Notifications
You must be signed in to change notification settings - Fork 1
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
Invoice Form and Payments #387
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual tests would be great, but this looks really good.
}" | ||
hx-post="{% url "opportunity:invoice_approve" org_slug=request.org.slug pk=opportunity.pk %}" | ||
hx-swap="none" | ||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need a csrf token? shouldn't the django form handle this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django was not able to find csrf token on forms submitted using 'hx-post'. This include the csrf token as a request header to provide the csrf token.
organization=opportunity.organization, | ||
invoice=invoice, | ||
) | ||
payment.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this create duplicates on multiple calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a filter to the query to only create payment for invoices that don't have a payment.
filter.addEventListener("change", (event) => { | ||
const url = new URL(window.location); | ||
url.searchParams.set("filter", event.target.value) | ||
history.pushState(null, '', url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just to share selections via URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this updates the URL to have the filter selected by user.
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> | ||
<button type="submit" class="btn btn-primary">Save changes</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing translations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. da288f2
I have a ticket for which I am considering to create an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would still love tests but won't block
@calellowitz i will add tests for the PR in a subsequent PR once the changes are deployed. |
Network Manager Views
Program Manager Views