404 error when trying to add a related (FK) object #12
Comments
Yep, it's require a custom template tag to create a valid link. But seems it's not the last issue with new items creation. |
@kmmbvnr can i help you with this problem? Maybe if you can point me to some file, code or doc? |
Here is how the url created in admin widget - https://github.com/django/django/blob/master/django/contrib/admin/widgets.py#L286 Basically, this should be recreated somehow in . /admin/templates/material/fields/django_relatedfieldwidgetwrapper.htm Unfortunatelly django does not provide convinient methods on widget to get proper url in template, so i suppose it could be implemented as new tempate tag for material_admin template tags library |
Another option is to make material/fields/django_relatedfieldwidgetwrapper.htm very simple, leave only {{ bound_field }} as content and do everything in admin/related_widget_wrapper.html It have propery context with all required urls. |
Actually i like the second option. If all django widgets was implemented as RelatedFieldWidgetWrapper most of django-material forms handing code will go away. Unfortunately only RelatedFieldWidgetWrapper have rendered using django template |
Use django rendering for bound field and customize only template as advised by @kmmbvnr
I have tested now and it's working. |
Should be fixed now |
In my model form i have some FK to another models, and when trying to add them in the admin, i got a 404 error. The problem seems to be at:
. /admin/templates/material/fields/django_relatedfieldwidgetwrapper.html:
I have attached a screenshot, when i click '+' i got the 404 error. Unfortunatly i dont know how to fix this issue to send a pr :-\
The text was updated successfully, but these errors were encountered: