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 ServiceResource(ModelResource): | |
manager = fields.ToOneField(UserResource, 'manager',full=True) | |
area = fields.ToOneField(AreaResource, 'area',full=True) | |
specification = fields.ToManyField('services.api.ServiceSpecResource','servicespec_set',full=True) | |
class Meta: | |
queryset = Service.objects.all() | |
resource_name = 'service' | |
class ServiceSpecResource(ModelResource): | |
service = fields.ToOneField(ServiceResource,'service') |
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
// First go to https://secure.studentfinance.direct.gov.uk/ and log in. | |
// Now go to https://secure.studentfinance.direct.gov.uk/customer/payments/view?service=direct/1/Home/listPayments_TablePages.pages_linkPage&sp=AHome%2FlistPayments_TableView&sp=1 | |
// Now open the console and put in: | |
// | |
// var jq = document.createElement('script'); | |
// jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"; | |
// document.getElementsByTagName('head')[0].appendChild(jq); | |
// jQuery.noConflict(); | |
// | |
// Press enter. |
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
/** | |
* This plugin hook for React table provides the ability for percentage | |
* widths to be provided in the column definitions, whilst maintaining the | |
* ability to resize those columns. | |
*/ | |
export const usePercentageColumns = hooks => { | |
hooks.useInstance.push(useInstance) | |
hooks.getRowProps.push(getRowStyles) | |
hooks.getHeaderProps.push(getHeaderProps) | |
hooks.getCellProps.push(getCellProps) |
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
// This method of detecting changes in a list of elements is a sledgehammer and probably memory intense if your DOM is already memory intense. | |
// But leaning on the semantics of the web platforms `isEqualNode` is useful if those semantics are what you are after. | |
// | |
// The semantics are much closer to a "meaningful change" than comparing element references. But dont go all the way to | |
// a "user visible change" guarantee since that depends if things like certain possible attribute changes amount | |
// to a visible change in your app. | |
// | |
// It differs from the usual way of detecting changes (which should remain the usual, this gist is for edge cases). The | |
// usual way being targetted comparison of some individual aspects of the elements, e.g. visible text. The difference is | |
// that this is a good middle ground for detecting "any characteristic change" of an element in cases where perhaps you need |