def import_terminal(self, row): try: Terminal.objects.get(description=row[0]) print('Terminal', row[0], 'already registered') except ObjectDoesNotExist: terminal = Terminal() terminal.description = row[0] terminal.save()
def import_terminal(self, row): """ This method is used for creating the objects of terminals. """ try: Terminal.objects.get(description=row[0]) print('Terminal', row[0], 'already registered') except ObjectDoesNotExist: terminal = Terminal() terminal.description = row[0] terminal.save()