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

Initial development #1

Merged
merged 65 commits into from
May 22, 2020
Merged
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
584727d
WIP: Initial commit
KalobTaulien Apr 22, 2020
a795153
Package support
KalobTaulien Apr 22, 2020
aaeee4a
Minor adjustments
KalobTaulien Apr 30, 2020
389fdeb
Adding debug statements for easier local development
KalobTaulien Apr 30, 2020
04d368e
Documentation updates
KalobTaulien Apr 30, 2020
b39d5e7
Local debugging support
KalobTaulien Apr 30, 2020
04c70f1
Example integrations
KalobTaulien Apr 30, 2020
0fd2315
Better mapping support
KalobTaulien Apr 30, 2020
780b199
Dev notes
KalobTaulien Apr 30, 2020
3685865
Page dictionary support for unique column_name to field_name mapping
KalobTaulien May 1, 2020
d4ee236
Moved logic to outside method
KalobTaulien May 1, 2020
9091280
Moved private method down as setup method is more important
KalobTaulien May 1, 2020
5fe5370
Added docs around the EXTRA_SUPPORTED_MODELS setting
KalobTaulien May 1, 2020
6352d19
Cleanup & Airtable best practices doc
KalobTaulien May 4, 2020
7ca0098
Added a known issue
KalobTaulien May 4, 2020
8c918f4
Somewhat handle multiple returned records
KalobTaulien May 4, 2020
69c4ebf
Auto-register airtable import admin url
KalobTaulien May 4, 2020
0fc0ccb
Support additional model import in the template
KalobTaulien May 4, 2020
b045538
ctrl+z; undoing last commit as it was a bad idea
KalobTaulien May 4, 2020
3303508
Optional setting: disable airtable importing on pecific models
KalobTaulien May 4, 2020
22b04ed
Adding api response memoization
KalobTaulien May 4, 2020
e88aa38
Docs and extra model support
KalobTaulien May 4, 2020
a415f22
Resets all airtable record ids from management command
KalobTaulien May 5, 2020
6e5f043
Small fixes
KalobTaulien May 5, 2020
b3c7e57
Moved testing const to mixin file
KalobTaulien May 5, 2020
36416e3
Try/catch a failed Airtable request
KalobTaulien May 6, 2020
f726dbb
Remove cache purge line
KalobTaulien May 6, 2020
4e3ab70
Add Airtable record to object when creating a new record
KalobTaulien May 6, 2020
d89ec15
Auto increment model pks when creating new model from an import
KalobTaulien May 6, 2020
33ffc17
Better json to dict evaluation
KalobTaulien May 7, 2020
57973dd
Properly create new models from Airtable withour throwing an Integrit…
KalobTaulien May 7, 2020
a641d80
Use POST instead of GET requests
KalobTaulien May 7, 2020
93e996f
Default message when no models are configured
KalobTaulien May 12, 2020
ce28580
Hide Import menu option when disabled
KalobTaulien May 12, 2020
d11bf42
Django messages when page is saved w/ or w/o airtable record update
KalobTaulien May 12, 2020
4a6e32a
Future Snippet hook support
KalobTaulien May 12, 2020
34be856
Mock Airtable Client
KalobTaulien May 14, 2020
57ab574
Ignore common files and dirs
KalobTaulien May 14, 2020
b1b118b
View, Model and Mixin tests
KalobTaulien May 14, 2020
c34b157
Refactoring import command as separate class; writing tests for the n…
KalobTaulien May 15, 2020
5bf118c
Import management command tests
KalobTaulien May 18, 2020
bbc16a4
Cleanup + Black formatting
KalobTaulien May 18, 2020
30cbb4e
Flake8 formatting (sans E501's from Black formatting)
KalobTaulien May 18, 2020
73f9362
Check is Mixin is enabled before creating ERROR/SUCCESS messages
KalobTaulien May 18, 2020
5332460
Animated preview and test docs
KalobTaulien May 18, 2020
a6fac29
API key documentation line
KalobTaulien May 19, 2020
d1f6f67
Reusable test dictionaries; fixed a test
KalobTaulien May 19, 2020
ed94594
Misc. updates from code review
KalobTaulien May 20, 2020
b434f79
Removed EXTRA_SUPPORTED_MODELS in favour of re-using dictionaries
KalobTaulien May 20, 2020
5a1d340
Moving common logic into util functions
KalobTaulien May 20, 2020
26286ce
Better way to save models
KalobTaulien May 20, 2020
7d710ef
Use Importer and util functions instead of the call call_command
KalobTaulien May 20, 2020
8223804
Util tests
KalobTaulien May 20, 2020
b1aacb8
ImproperlyConfigured exception
KalobTaulien May 20, 2020
0787f8a
'None' => None
KalobTaulien May 20, 2020
6b6f647
m2m support; renamed obj to instance
KalobTaulien May 20, 2020
6bde27d
Wording update
KalobTaulien May 20, 2020
57d52b4
Removed single record testing condition
KalobTaulien May 20, 2020
46b2dc6
Using empty str helps prevent default IntegrityErrors on non null tex…
KalobTaulien May 21, 2020
e8253d4
Default to False
KalobTaulien May 21, 2020
0d30697
Default AIRTABLE to False in hooks
KalobTaulien May 21, 2020
6b1ca24
fixup! Default AIRTABLE to False in hooks
KalobTaulien May 21, 2020
149859d
Group models with the same settings together
KalobTaulien May 21, 2020
ca98b9b
Review touchups and flake8
KalobTaulien May 22, 2020
9a795c4
Black formatting
KalobTaulien May 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions wagtail_airtable/management/commands/import_airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,20 @@ def debug_message(message):
records_used.append(record['id'])
continue


# First things first, remove any "pk" or "id" items form the mapped_import_fields
KalobTaulien marked this conversation as resolved.
Show resolved Hide resolved
# This will let Django and Wagtail handle the PK on its own, as it should.
# When the model is saved it'll trigger a push to Airtable and automatically update
# the necessary column with the new PK so it's always accurate.
try:
del mapped_import_fields['pk']
except KeyError:
pass
try:
del mapped_import_fields['id']
except KeyError:
pass

# If there is no match whatsoever, try to create a new `model` instance.
# Note: this may fail if there isn't enough data in the Airtable record.
try:
Expand Down