Show More
@@ -418,10 +418,19 b' class ThreadForm(PostForm):' | |||||
418 | raise forms.ValidationError( |
|
418 | raise forms.ValidationError( | |
419 | _('Inappropriate characters in tags.')) |
|
419 | _('Inappropriate characters in tags.')) | |
420 |
|
420 | |||
|
421 | default_tag_name = board_settings.get('Forms', 'DefaultTag')\ | |||
|
422 | .strip().lower() | |||
|
423 | ||||
421 | required_tag_exists = False |
|
424 | required_tag_exists = False | |
422 | tag_set = set() |
|
425 | tag_set = set() | |
423 | for tag_string in tags.split(): |
|
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 | tag_set.add(tag) |
|
434 | tag_set.add(tag) | |
426 |
|
435 | |||
427 | # If this is a new tag, don't check for its parents because nobody |
|
436 | # If this is a new tag, don't check for its parents because nobody | |
@@ -434,9 +443,8 b' class ThreadForm(PostForm):' | |||||
434 | required_tag_exists = True |
|
443 | required_tag_exists = True | |
435 | break |
|
444 | break | |
436 |
|
445 | |||
|
446 | # Use default tag if no section exists | |||
437 | if not required_tag_exists: |
|
447 | if not required_tag_exists: | |
438 | default_tag_name = board_settings.get('Forms', 'DefaultTag')\ |
|
|||
439 | .strip().lower() |
|
|||
440 | default_tag, created = Tag.objects.get_or_create( |
|
448 | default_tag, created = Tag.objects.get_or_create( | |
441 | name=default_tag_name, required=True) |
|
449 | name=default_tag_name, required=True) | |
442 | tag_set.add(default_tag) |
|
450 | tag_set.add(default_tag) |
General Comments 0
You need to be logged in to leave comments.
Login now