You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A long standing issue in Django had a direct consequence on our project. Contenttype fields, entity_content_type and entity_object_id, (default names suggested by the Django framework) did not have a good widget attached to them so one had to manually query the database to find the instance ID in order to populate the fields.
In 2019, a PR was submitted and merged which added a workaround to select entity_content_type using a dropdown list and the entity_object_id from a popup window. Being a workaround, it also brought some limitations with it.
Under-the-hood JavaScript written to render the popup window only gets triggered when the fields are named entity_content_type and entity_object_id. This posed problems in apps like noticeboard where the field names are different - persona_content_type.
The code is not reusable which undermines the philosophy of Omniport.
Describe the solution you'd like
To convert this workaround into a concrete solution, I suggest making a Django Widget or a model field in a different repository (let's keep it under @IMGIITRoorkee only). Further, we can publish the package to PyPI. Eventually, solving both of the problems listed above.
The widget or the model field should add the following functionality:
Convert the entity_content_type (the name can by anything) field from a text field to dropdown list.
Clicking an option in the list should trigger a pop-up which would contain all instances of the selected model in contenttype.
The instances in the pop-up window should be paginated so that the request doesn't timeout.
It should also have a search functionality so that the maintainers do not spend too much time finding the instance they are looking for.
Support for adding custom styles to the widget. Not a priority at all.
Upon clicking an instance, the pop-up should close and write its primary key to the entity_object_id (again, name can be anything) field.
There can be more features or the implementation might be different but that is subjected to the discussion under this ticket.
Additional context
PRs related to the previous work on this.
@pradumangoyal told me about an existing package which does this. However, while skimming through the codebase, I could not find functionality for pagination or search. But I may be wrong and in that case, feel free to close the ticket.
Is your feature request related to a problem? Please describe.
A long standing issue in Django had a direct consequence on our project. Contenttype fields,
entity_content_type
andentity_object_id
, (default names suggested by the Django framework) did not have a good widget attached to them so one had to manually query the database to find the instance ID in order to populate the fields.In 2019, a PR was submitted and merged which added a workaround to select
entity_content_type
using a dropdown list and theentity_object_id
from a popup window. Being a workaround, it also brought some limitations with it.persona_content_type
.Describe the solution you'd like
To convert this workaround into a concrete solution, I suggest making a Django Widget or a model field in a different repository (let's keep it under @IMGIITRoorkee only). Further, we can publish the package to PyPI. Eventually, solving both of the problems listed above.
The widget or the model field should add the following functionality:
entity_content_type
(the name can by anything) field from a text field to dropdown list.entity_object_id
(again, name can be anything) field.There can be more features or the implementation might be different but that is subjected to the discussion under this ticket.
Additional context
PRs related to the previous work on this.
Want to take up?
Definitely up for reviewing or answering more questions.
The text was updated successfully, but these errors were encountered: