Skip to content

Commit

Permalink
Fix clear option in import data command
Browse files Browse the repository at this point in the history
  • Loading branch information
marioba committed Aug 19, 2021
1 parent b20e7cf commit 98078d3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion comptages/datamodel/management/commands/importdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@ def handle(self, *args, **options):

if options["clear"]:
print("Deleting...")

ClassCategory.objects.all().delete()
Category.objects.all().delete()
SensorTypeClass.objects.all().delete()
SensorTypeModel.objects.all().delete()
SensorTypeInstallation.objects.all().delete()
SensorType.objects.all().delete()
ModelClass.objects.all().delete()
Class.objects.all().delete()
Device.objects.all().delete()
Model.objects.all().delete()
Brand.objects.all().delete()
Installation.objects.all().delete()
Lane.objects.all().delete()
Section.objects.all().delete()
Brand.objects.all().delete()

self.import_sections(self.file_path("section.csv"))
self.import_brands(self.file_path("brand.csv"))
Expand Down

0 comments on commit 98078d3

Please sign in to comment.