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 form_soup_to_dict(form_soup, add_save=False): | |
""" | |
Transforms form data with initial values to a dictionary that can be used for POST request. | |
* `add_save` - In Django Admin forms POST data expects `_save` to make the request. | |
""" | |
data = {} | |
for input_field in form_soup.find_all('input'): | |
# We have some custom buttons added to the Django Admin |
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 LimitOffsetPrepagination(LimitOffsetPagination): | |
def __init__(self, request): | |
self.request = request | |
def paginate_queryset(self, queryset, postpagination=None): | |
self.results = super().paginate_queryset(queryset=queryset, request=self.request) | |
if postpagination: | |
self.results = postpagination(self.results) |
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
# in example.py | |
def inner_func(x=None): | |
if x is None: | |
return 1 | |
return x + 1 | |
def big_func(): |
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
import React from 'react'; | |
import _ from 'lodash'; | |
import { withRouter, RouteComponentProps } from 'react-router-dom'; | |
import { connect } from 'react-redux'; | |
import { Diff } from 'utility-types'; | |
import { AppState } from 'globalReducer'; | |
import { | |
openDialog, | |
closeDialog, |
OlderNewer