django-gsheets icon indicating copy to clipboard operation
django-gsheets copied to clipboard

Sync will create duplicate

Open luqmansen opened this issue 4 years ago • 1 comments

The current management command does both sync pull and push, this could create duplicates when the row deleted from the admin panel, then run the sync command.

How to reproduce

  1. Delete one/or all row from specific models via admin panel
  2. Run sync management command
  3. All data will be duplicated

My proposal was to be able to give the management command optional argument to run only pull or only push action. Can I make PR for this?

luqmansen avatar Oct 15 '20 05:10 luqmansen

Anyway, I just saw this docstring on the source code

 functionality to pull data from a google sheet and use that data to keep model data updated. Notes:
    * won't delete rows that are in the DB but not in the sheet
    * won't delete rows that are in the sheet but not the DB
    * will update existing row values with values from the sheet

So, if I'm not mistaken, the current command isn't able to delete from 1 of the source (DB or Sheet) and then sync the result correct?

luqmansen avatar Oct 16 '20 04:10 luqmansen