Skip to content
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

Handle prefix as generic.FormMixin does #154

Merged
merged 1 commit into from
Oct 28, 2017
Merged

Handle prefix as generic.FormMixin does #154

merged 1 commit into from
Oct 28, 2017

Conversation

melvyn-sopacua
Copy link
Contributor

When using forms rendered as modals on a larger page, it is convenient
to use form prefixes passed by GET parameter.
Using the get_prefix method then allows us to return and handle the
prefix correctly:

class PrefixedFormMixin(generic.edit.FormMixin):
    def get_prefix(self):
        return self.request.GET.get('prefix', self.prefix)

Ref:
http://ccbv.co.uk/projects/Django/1.11/django.views.generic.edit/FormMixin/#get_prefix

When using forms rendered as modals on a larger page, it is convenient
to use form prefixes passed by GET parameter.
Using the `get_prefix` method then allows us to return and handle the
prefix correctly:

```python
class PrefixedFormMixin(generic.edit.FormMixin):
    def get_prefix(self):
        return self.request.GET.get('prefix', self.prefix)
```

Ref:
http://ccbv.co.uk/projects/Django/1.11/django.views.generic.edit/FormMixin/#get_prefix
@codecov-io
Copy link

codecov-io commented Oct 28, 2017

Codecov Report

Merging #154 into master will increase coverage by 0.07%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #154      +/-   ##
==========================================
+ Coverage   53.99%   54.06%   +0.07%     
==========================================
  Files           6        6              
  Lines         526      529       +3     
  Branches       62       62              
==========================================
+ Hits          284      286       +2     
- Misses        222      223       +1     
  Partials       20       20
Impacted Files Coverage Δ
extra_views/formsets.py 48.17% <40%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5f1155...784793e. Read the comment docs.

@jonashaag jonashaag merged commit 69c7067 into AndrewIngram:master Oct 28, 2017
@melvyn-sopacua melvyn-sopacua deleted the prefix-handling branch October 28, 2017 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants