Skip to content

Commit 0dbbca8

Browse files
Merge pull request #17 from kevinhowbrook/16-add-limit-param
Adds limit param and settings so more forms can be fetched
2 parents dc1d43f + 1e456e2 commit 0dbbca8

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ You will need an API key from Jotform. Add the following variables to your setti
2424
WAGTAIL_JOTFORM = {
2525
"API_KEY": "somekey",
2626
"API_URL": "https://api.jotform.com",
27+
"LIMIT": 50,
2728
}
2829
```
2930

31+
`LIMIT` is the number of results in each result set for form list. Default is 50. Maximum is 1000.
32+
3033
If your Jotform account is in [EU safe mode](https://www.jotform.com/eu-safe-forms/), your `JOTFORM_API_URL` should be `https://eu-api.jotform.com`.
3134

3235
Add the following to your `INSTALLED_APPS` in settings, and note that `wagtail_jotform` depends on `routable_page`:

wagtail_jotform/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VERSION = (1, 0, 3)
1+
VERSION = (1, 0, 4)
22
__version__ = ".".join(map(str, VERSION))

wagtail_jotform/tests/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@
7272
WAGTAIL_JOTFORM = {
7373
"API_KEY": "somekey",
7474
"API_URL": "https://wagtail-jotform.com",
75+
"LIMIT": 50,
7576
}

wagtail_jotform/tests/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def test_settings(self):
160160
del settings.WAGTAIL_JOTFORM
161161
self.assertFalse(wagtail_jotform_settings.API_KEY)
162162
self.assertFalse(wagtail_jotform_settings.API_URL)
163+
self.assertFalse(wagtail_jotform_settings.LIMIT)
163164

164165
def test_page_renders_with_bad_settings(self):
165166
response = self.client.get("/embeded-form-page/")

wagtail_jotform/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def fetch_data(url, headers=None, **params):
3838

3939

4040
def fetch_jotform_data():
41-
41+
limit = wagtail_jotform_settings.get("LIMIT", 50)
4242
headers = {"APIKEY": wagtail_jotform_settings.API_KEY}
43-
url = f"{wagtail_jotform_settings.API_URL}/user/forms"
43+
url = f"{wagtail_jotform_settings.API_URL}/user/forms?limit={limit}"
4444

4545
return fetch_data(url, headers)
4646

0 commit comments

Comments
 (0)