# source_ports = forms.ModelMultipleChoiceField(queryset=MatchPort.objects.all(), help_text=ugettext_lazy("A set of source ports to block"), label=ugettext_lazy("Source Ports"), required=False)
# destination = forms.CharField(help_text=ugettext_lazy("A qualified IP Network address. CIDR notation,"
# destination_ports = forms.ModelMultipleChoiceField(queryset=MatchPort.objects.all(), help_text=ugettext_lazy("A set of destination ports to block"), label=ugettext_lazy("Destination Ports"), required=False)
# ports = forms.ModelMultipleChoiceField(queryset=MatchPort.objects.all(), help_text=ugettext_lazy("A set of ports to block"), label=ugettext_lazy("Ports"), required=False)
classRouteForm(forms.ModelForm):
classMeta:
model=Route
...
...
@@ -58,142 +56,59 @@ class RouteForm(forms.ModelForm):
raiseforms.ValidationError('This field is required.')
raiseforms.ValidationError(_('Destination address/network should belong to your administrative address space. Check My Profile to review your networks'))
if (sourceportsandports):
raiseforms.ValidationError(_('Cannot create rule for source ports and ports at the same time. Select either ports or source ports'))
if (destinationportsandports):
raiseforms.ValidationError(_('Cannot create rule for destination ports and ports at the same time. Select either ports or destination ports'))
ifsourceportsandnotsource:
raiseforms.ValidationError(_('Once source port is matched, source has to be filled as well. Either deselect source port or fill source address'))
ifdestinationportsandnotdestination:
raiseforms.ValidationError(_('Once destination port is matched, destination has to be filled as well. Either deselect destination port or fill destination address'))