Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wizard related error #244

Closed
joshyu opened this issue Aug 20, 2024 · 4 comments · Fixed by #245
Closed

wizard related error #244

joshyu opened this issue Aug 20, 2024 · 4 comments · Fixed by #245

Comments

@joshyu
Copy link
Contributor

joshyu commented Aug 20, 2024

As @fsbraun removed the get_absolute_url via this PR ( #199), and our new alias entry is in the wizard creation. so we will get some errors when we create new alias and alias category via wizard button.

image

This is related to below function call in wizard_base.py fil in django cms
image

I think we need to fix that.

@fsbraun ,
please provide your input.

@fsbraun
Copy link
Member

fsbraun commented Aug 20, 2024

@joshyu Well spotted!

Indeed, the default wizard assumes the model created has a get_absolute_url method, AliasCategory does not since it does not offer a URL to the user space.

We need to overwrite get_success_url in the alias category wizard. It needs to return the category's get_admin_change_url. Would you like to make a PR?

@joshyu
Copy link
Contributor Author

joshyu commented Aug 20, 2024

@fsbraun,
How to override the get_success_url in the alias? Do you have any reference for me?
sorry I didn't work on this part before. I need a sample, you can tell me to check which addon.

@fsbraun
Copy link
Member

fsbraun commented Aug 20, 2024

Just add a method to this:

class CreateAliasCategoryWizard(Wizard):
def user_has_add_permission(self, user, **kwargs):
return user.has_perm(
get_model_permission_codename(Category, "add"),
)

Something like:

def get_success_url(self, obj, **kwargs):
    return obj.get_admin_change_url()

@joshyu joshyu mentioned this issue Aug 20, 2024
2 tasks
@joshyu
Copy link
Contributor Author

joshyu commented Aug 20, 2024

@fsbraun ,

please help to review the PR #245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants