Title: How to limit targets in move page view · Issue #41 · feincms/feincms3 · GitHub
Open Graph Title: How to limit targets in move page view · Issue #41 · feincms/feincms3
X Title: How to limit targets in move page view · Issue #41 · feincms/feincms3
Description: It would be nice to have a way to disallow certain targets in the move view - e.g. moving pages outside of a "Home" node or disallow moving pages before fixed pages (read: node stays always on top in menu). I tried to monkey patch feincm...
Open Graph Description: It would be nice to have a way to disallow certain targets in the move view - e.g. moving pages outside of a "Home" node or disallow moving pages before fixed pages (read: node stays always on top ...
X Description: It would be nice to have a way to disallow certain targets in the move view - e.g. moving pages outside of a "Home" node or disallow moving pages before fixed pages (read: node stays alwa...
Opengraph URL: https://github.com/feincms/feincms3/issues/41
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How to limit targets in move page view","articleBody":"It would be nice to have a way to disallow certain targets in the move view - e.g. moving pages outside of a \"Home\" node or disallow moving pages before fixed pages (read: node stays always on top in menu).\r\n\r\nI tried to monkey patch feincms3.admin.MoveForm.__generate_choices method and filter only for allowed pages but to no success.\r\n\r\nI somehow got it working now by overwriting the feincms3.admin.MoveForm.clean() method - but that feels wrong and is not very user friendly as all the move targets are still shown in the admin UI:\r\n\r\n```python\r\nclass MyMoveForm(MoveForm):\r\n def clean(self):\r\n data = super().clean()\r\n if not data.get(\"new_location\"):\r\n return data\r\n if self.request.user.is_superuser:\r\n return data\r\n\r\n # don't allow to create a new root node\r\n relative = data[\"relative\"]\r\n first_or_right = data[\"first_or_right\"]\r\n if not relative:\r\n raise ValidationError(\"You do not have the permission to move this page here!\")\r\n elif first_or_right =='right' and not relative.parent:\r\n raise ValidationError(\"You do not have the permission to move this page here!\")\r\n\r\n\r\n@admin.register(models.Page)\r\nclass PageAdmin(ContentEditor, TreeAdmin):\r\n ...\r\n\r\n def move_view(self, request, obj):\r\n return self.action_form_view(\r\n request, obj, form_class=MyMoveForm, title=f\"Move {obj}\"\r\n )\r\n```\r\n\r\nAn option to disallow certain pages as move target or any idea how to tackle that in a smart way is very appreciated. ","author":{"url":"https://github.com/barsch","@type":"Person","name":"barsch"},"datePublished":"2024-05-02T02:37:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/41/feincms3/issues/41"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e4aa54b0-b2b5-41c1-09e6-f8451a78516c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9320:381D90:1005236:165B702:6977AA8C |
| html-safe-nonce | e11cdaf46211c2676ba159c3a3871c12bb047cf17d567543ca575472c5eeded8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzIwOjM4MUQ5MDoxMDA1MjM2OjE2NUI3MDI6Njk3N0FBOEMiLCJ2aXNpdG9yX2lkIjoiNjgyMjgzMTQ3NzM0NDQxNDM0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cb09c32909983ecc88414f8ffae4c325681c210eee785d923f78e14dff188fbe |
| hovercard-subject-tag | issue:2274482082 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feincms/feincms3/41/issue_layout |
| twitter:image | https://opengraph.githubassets.com/171f2649182171603f4c0cdbb0318dc8682774ca0a50aed8a412b002dec67f2a/feincms/feincms3/issues/41 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/171f2649182171603f4c0cdbb0318dc8682774ca0a50aed8a412b002dec67f2a/feincms/feincms3/issues/41 |
| og:image:alt | It would be nice to have a way to disallow certain targets in the move view - e.g. moving pages outside of a "Home" node or disallow moving pages before fixed pages (read: node stays always on top ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | barsch |
| hostname | github.com |
| expected-hostname | github.com |
| None | e8b91803a5fc7ac066710509c57c636dab6ed4620bd9213b470a4617c79989c9 |
| turbo-cache-control | no-preview |
| go-import | github.com/feincms/feincms3 git https://github.com/feincms/feincms3.git |
| octolytics-dimension-user_id | 935594 |
| octolytics-dimension-user_login | feincms |
| octolytics-dimension-repository_id | 61632866 |
| octolytics-dimension-repository_nwo | feincms/feincms3 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 61632866 |
| octolytics-dimension-repository_network_root_nwo | feincms/feincms3 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9b4562e3c5c60b38349a7d80ec8e160c11fe84b6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width