The model form are supported in the formapi and details#5
The model form are supported in the formapi and details#5goinnn wants to merge 2 commits into5monkeys:masterfrom
Conversation
goinnn
commented
Jun 27, 2013
- Now the model form are supported in the formapi.
- A simple way to pass the request to your form (request_passed)
- If you overwrite the get_form_kwargs method you can pass more parameters to your form
- And some details: reorder the imports, change API.xxx to cls.xxx or self.xxx, remove the clean method from APICall, etc
… the request to your form. And some details
|
@hannseman Something about this? |
|
@goinnn What about failing tests? |
|
@andreif So sorry I don't see this error |
|
@goinnn Great, thanks! I am not familiar with this project though, so I would wait @hannseman and @carlmarten to comment. However, I feel like some extra tests are required since you are adding new things here. |
|
@andreif Ok, thanks!. @hannseman or @carlmarten when you see it please tell me something about the tests... if this pull request needs tests, and What are the necessary tests? |
|
Hey @goinnn! Thanks for the PR. Please add tests for the APIModelCall, like updating |
There was a problem hiding this comment.
Is there a reason why you're serializing the object in the form and not letting render_to_json_response handle this? I don't think we should have two ways to serialize data returned from action()
|
I'm also thinking about the whole choosing if you want request passed to your class API(FormView):
def get_form_kwargs(self):
kwargs = super(API, self).get_form_kwargs()
form_class = self.get_form_class()
if self.request:
kwargs['request'] = self.request
if isinstance(form_class, APIModelCall):
kwargs.update(self._get_model_form_kwargs())
return kwargsclass APICall(forms.Form):
def __init__(self, request=None, *args, **kwargs):
super(APICall, self).__init__(*args, **kwargs)
self.request = requestI might not be thinking of all use cases but this shouldn't hurt backwards compatibility. What do you think? |
|
Ineed help |