def clean_cat(self): # If request category is a tarako one, get the corresponding list of # slugs, otherwise just build a list with the slug requested. if self.cleaned_data['cat']: return TARAKO_CATEGORIES_MAPPING.get(self.cleaned_data['cat'], [self.cleaned_data['cat']]) return None
def clean_cat(self): # If request category is a tarako one, get the corresponding list of # slugs, otherwise just build a list with the slug requested. cat = self.cleaned_data['cat'] if cat.startswith('tarako'): return TARAKO_CATEGORIES_MAPPING.get(cat, [cat]) if cat in CATEGORY_REDIRECTS: return [CATEGORY_REDIRECTS[cat]] if cat: return [cat]