Record
Controller for displaying an individual record Loads all the data and then defers render function to view objects.
dwc(package_name, resource_id, record_id, version)
¶
View an individual record using the DwC view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
the package name or ID, doesn't matter which |
required | |
record_id
|
the record ID |
required | |
resource_id
|
the resource ID |
required | |
version
|
optional record version, defaults to None which will be interpreted as now |
required |
Returns:
| Type | Description |
|---|---|
|
the rendered view template from the correct record view class |
Source code in ckanext/nhm/routes/record.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
init_jinja_extensions()
¶
This hook is called before the first request is received by the app and therefore allows us to ensure that the taxonomy extension is loaded into jinja2 before it's used.
Source code in ckanext/nhm/routes/record.py
69 70 71 72 73 74 75 76 77 | |
json_view(package_name, resource_id, record_id, version)
¶
View the record as JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
the package name or ID, we don't actually need this |
required | |
resource_id
|
the resource ID, we do need this! |
required | |
record_id
|
the record ID, stunningly enough we need this too |
required | |
version
|
optional record version, defaults to None which will be interpreted as now |
required |
Returns:
| Type | Description |
|---|---|
|
the record data as a dict which will be turned into JSON automatically by Flask, huzzah |
Source code in ckanext/nhm/routes/record.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
prepare_image(image)
¶
Given an image object, return a dict of information about it for the view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
RecordImage
|
the RecordImage object |
required |
Returns:
| Type | Description |
|---|---|
dict
|
a dict of info |
Source code in ckanext/nhm/routes/record.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
update_render_context(record)
¶
Sets the various expected context variables for the templates.
The values set here are used in some of our templates and some core CKAN ones too, it's a bit of a mess (especially for packages).
Source code in ckanext/nhm/routes/record.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
view(package_name, resource_id, record_id, version)
¶
View an individual record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
the package name or ID, doesn't matter which |
required | |
record_id
|
the record ID |
required | |
resource_id
|
the resource ID |
required | |
version
|
optional record version, defaults to None which will be interpreted as now |
required |
Returns:
| Type | Description |
|---|---|
|
the rendered view template from the correct record view class |
Source code in ckanext/nhm/routes/record.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |