Open bbelderbos opened 2 years ago
moved comment to [baker] sync S3 bucket#50
moved comment to [Baker] User Approval/Rejection of Treat Requests#45
removed coupon detail since both the baker user and the recipient user have list representations of their coupons
some issues with coupon deletion still...
seems like it might be related to using coupon.id
instead of coupon_id
which might be in the django 4 book...
<a href="{% url "treats:coupon_delete" coupon.id %}">Delete Coupon</a>
vs
<a href="{% url "treats:coupon_delete" coupon_id %}">Delete Coupon</a>
I'm going to take a look in the morning
Should be former, in the view you pass a coupon
object to the template:
return render(request, 'coupons/coupon-detail.html', context={'coupon': coupon})
Unfortunately templates often fail silently so it would not tell you that coupon_id
is not defined as regular Python would. Hence you then hit an error of a misconstructed URL.
Based on urls.py pattern:
path('delete/<int:pk>/coupon', views.coupon_edit, name='coupon_delete'),
... I would expect
<a href="{% url "treats:coupon_delete" coupon.id %}">Delete Coupon</a>
to work fine, is it not?
@adamdoty confirming I can successfully delete coupons as baker.
@bbelderbos getting Foreign Key Constraint when I try to delete certain coupons. Tried searching, looking into what the foreign key constraint is, but just getting confused.
moved comment to [baker] sync S3 bucket#50