Skip to content

get_success_url based on lookup_field? #86

Description

@djpeacher

Hey Carlton 👋🏼 I created a view with a custom lookup_field but I noticed the create form failed to redirect on success because it was still trying to use pk. Unless I'm completely missing something, should get_success_url be updated to handle custom lookups, maybe using Role.reverse?

def get_success_url(self):
    ...
    if self.role == Role.DELETE:
        success_url = Role.LIST.reverse(self)
    else:
        success_url = Role.DETAIL.reverse(self, self.object)
    return success_url

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions