Created
April 15, 2020 03:53
-
-
Save daimon99/7e42b2d6767f3e136bb3680cb0c25436 to your computer and use it in GitHub Desktop.
Django admin 新建记录页面表单初始值 / Django admin add form initial value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_changeform_initial_data(self, request): | |
init = super().get_changeform_initial_data(request) | |
init['company'] = get_user_last_company(request.user) | |
return init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment