Skip to content

Commit

Permalink
Merge pull request #672 from WHOIGit/mario_dev_1.7.0
Browse files Browse the repository at this point in the history
update import config logic
  • Loading branch information
ethanandrews authored Jul 24, 2024
2 parents 42d7dd0 + 6ad312e commit 82dd640
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roundabout/ooi_ci_tools/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def validate_cal_files(csv_files,ext_files):
try:
import_config = ImportConfig.objects.get(id=1)
except ImportConfig.DoesNotExist:
import_config = None
import_config = ImportConfig.objects.create(id=1)
for cal_csv in csv_files:
counter += 1
cal_csv_filename = cal_csv.name[:-4]
Expand Down
7 changes: 5 additions & 2 deletions roundabout/ooi_ci_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,12 @@ class ImportConfigUpdate(LoginRequiredMixin, AjaxFormMixin, UpdateView):

def get(self, request, *args, **kwargs):
if ImportConfig.objects.exists():
self.object = self.get_object()
try:
self.object = ImportConfig.objects.get(id=1)
except:
self.object = ImportConfig.objects.create(id=1)
else:
self.object = ImportConfig.objects.create()
self.object = ImportConfig.objects.create(id=1)
form_class = self.get_form_class()
form = self.get_form(form_class)
return self.render_to_response(
Expand Down

0 comments on commit 82dd640

Please sign in to comment.