##// END OF EJS Templates
If the first thread is created with not section existing yet, default tag will be added if it is the only one specified
neko259 -
r1658:b924e5d9 default
parent child Browse files
Show More
@@ -418,10 +418,19 b' class ThreadForm(PostForm):'
418 418 raise forms.ValidationError(
419 419 _('Inappropriate characters in tags.'))
420 420
421 default_tag_name = board_settings.get('Forms', 'DefaultTag')\
422 .strip().lower()
423
421 424 required_tag_exists = False
422 425 tag_set = set()
423 426 for tag_string in tags.split():
424 tag, created = Tag.objects.get_or_create(name=tag_string.strip().lower())
427 if tag_string.strip().lower() == default_tag_name:
428 required = True
429 required_tag_exitst = True
430 else:
431 required = False
432 tag, created = Tag.objects.get_or_create(
433 name=tag_string.strip().lower(), required=required)
425 434 tag_set.add(tag)
426 435
427 436 # If this is a new tag, don't check for its parents because nobody
@@ -434,9 +443,8 b' class ThreadForm(PostForm):'
434 443 required_tag_exists = True
435 444 break
436 445
446 # Use default tag if no section exists
437 447 if not required_tag_exists:
438 default_tag_name = board_settings.get('Forms', 'DefaultTag')\
439 .strip().lower()
440 448 default_tag, created = Tag.objects.get_or_create(
441 449 name=default_tag_name, required=True)
442 450 tag_set.add(default_tag)
General Comments 0
You need to be logged in to leave comments. Login now