django-cms icon indicating copy to clipboard operation
django-cms copied to clipboard

Selecting page defined in raw_id_fields does nothing

Open jegorami opened this issue 7 years ago • 2 comments

If "Page" M2M field is added to raw_id_fields, click on search button opens Pages popup tree, but click does not add page to the field and popup stays opened.

I guess context variable "is_popup" of render_page_row method in /cms/utils/admin.py should additionally check if IS_POPUP_VAR is present in request.META['HTTP_REFERER']

Expected behaviour

Selected page id should be added to page field and popup should be closed.

Actual behaviour

Nothing happens

If this issue is fixed, and we click on a page, page id and all parent ids up to the tree root are added to the field.

I guess onclick event propagation should be stopped.

Expected behaviour

Only selected page id is added to the "page" M2M field

Actual behaviour

Selected page id and all parent ids are added to the "page" M2M field

Also, it is not possible to open parent tree in order to select child node without selecting parent itself.

I guess the problem is a result of adding onclick event handler on the element with class cms-tree-node, so click on arrow for opening tree which is a part of the element also calls handler

Expected behaviour

Click on arrow for opening tree does not select element

Actual behaviour

Parent node that is added to the "page" field and dialog is closed

Environment

  • Python version: 2.7
  • Django version: 1.8
  • django CMS version: 3.4.4

jegorami avatar Sep 12 '17 17:09 jegorami

Hello! I have the same problem.

Python version: 3.6 Django version: 1.10.7 django CMS version: 3.4.4

jmrivas86 avatar Oct 16 '17 16:10 jmrivas86

I think this is kind of expected given that the pages list has a custom interface that most likely doesn't support this django feature.

That said there might be a simple way to fix it hence a PR is warmly welcome!

viktor-yunenko avatar Aug 19 '21 13:08 viktor-yunenko