Fix typo in delimiter

This commit is contained in:
Wolf-Bastian Poettner 2020-02-17 21:00:10 +00:00
parent 1ce94348d8
commit 2bd4eb2292

View File

@ -286,21 +286,21 @@ class Document(models.Model):
@staticmethod @staticmethod
def many_to_dictionary(field): def many_to_dictionary(field):
# Converts ManyToManyField to dictionary by assuming, that field # Converts ManyToManyField to dictionary by assuming, that field
# entries contain an _ or - which will be used as a delimeter # entries contain an _ or - which will be used as a delimiter
mydictionary = dict() mydictionary = dict()
for t in field.all(): for t in field.all():
# Find delimeter # Find delimiter
delimeter = t.name.find('_') delimiter = t.name.find('_')
if delimeter is -1: if delimiter is -1:
delimeter = t.name.find('-') delimiter = t.name.find('-')
if delimeter is -1: if delimiter is -1:
continue continue
key = t.name[:delimeter] key = t.name[:delimiter]
value = t.name[delimeter+1:] value = t.name[delimiter+1:]
mydictionary[slugify(key)] = slugify(value) mydictionary[slugify(key)] = slugify(value)