
from fragdev.contact import validate_ham
from django.forms import ModelForm
from django import forms
from wiblog.models import Comment

class CommentForm(ModelForm):
	verify = forms.CharField(label='Anti-spam: Type in the word "power"',validators=[validate_ham],max_length=5)
	class Meta:
		model = Comment
		fields = ('name', 'url', 'comment')


from django.forms import ModelForm
from django import forms
from fragdev.util.validate_ham import ANTI_SPAM, validate_ham
from wiblog.models import Comment

class CommentForm(ModelForm):
	verify = forms.CharField(label='Anti-spam: Type in the word "{}"'\
                .format(ANTI_SPAM),
                validators=[validate_ham],
                max_length=len(ANTI_SPAM))
	class Meta:
		model = Comment
		fields = ('name', 'url', 'comment')

Fix wiblog's use of the anti-spam validator
Fix wiblog's use of the anti-spam validator

  
- from fragdev.contact import validate_ham
  from django.forms import ModelForm
  from django import forms
+ from fragdev.util.validate_ham import ANTI_SPAM, validate_ham
  from wiblog.models import Comment
  
  class CommentForm(ModelForm):
- 	verify = forms.CharField(label='Anti-spam: Type in the word "power"',validators=[validate_ham],max_length=5)
+ 	verify = forms.CharField(label='Anti-spam: Type in the word "{}"'\
+                 .format(ANTI_SPAM),
+                 validators=[validate_ham],
+                 max_length=len(ANTI_SPAM))
  	class Meta:
  		model = Comment
  		fields = ('name', 'url', 'comment')
  
Fix wiblog's use of the anti-spam validator
## Code Before:

from fragdev.contact import validate_ham
from django.forms import ModelForm
from django import forms
from wiblog.models import Comment

class CommentForm(ModelForm):
	verify = forms.CharField(label='Anti-spam: Type in the word "power"',validators=[validate_ham],max_length=5)
	class Meta:
		model = Comment
		fields = ('name', 'url', 'comment')

## Instruction:
Fix wiblog's use of the anti-spam validator
## Code After:

from django.forms import ModelForm
from django import forms
from fragdev.util.validate_ham import ANTI_SPAM, validate_ham
from wiblog.models import Comment

class CommentForm(ModelForm):
	verify = forms.CharField(label='Anti-spam: Type in the word "{}"'\
                .format(ANTI_SPAM),
                validators=[validate_ham],
                max_length=len(ANTI_SPAM))
	class Meta:
		model = Comment
		fields = ('name', 'url', 'comment')
