-
Notifications
You must be signed in to change notification settings - Fork 15
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
The model form are supported in the formapi and details #5
base: master
Are you sure you want to change the base?
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 |
|
||
def action(self, test): | ||
obj = self.save() | ||
return self.serialize_obj(obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 kwargs class APICall(forms.Form):
def __init__(self, request=None, *args, **kwargs):
super(APICall, self).__init__(*args, **kwargs)
self.request = request I might not be thinking of all use cases but this shouldn't hurt backwards compatibility. What do you think? |
Ineed help |