Created
March 26, 2019 15:26
-
-
Save elyssonmr/f893396ceae7fb802b20d58a63660808 to your computer and use it in GitHub Desktop.
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
class MyFormClass(forms.ModelForm): | |
def __init__(self, *args, **kwargs): | |
super() | |
pk = kwargs.pop("pk", None) | |
if pk: | |
self.field_with_querystring.query = Something.objects.filter(pk=pk) | |
form = MyFormClass(pk=client_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment