Revision 552eaedd

b/flowspec/forms.py
130 130
            raise forms.ValidationError('Fill at least a Rule Match Condition')
131 131
        if not user.is_superuser and then[0].action not in settings.UI_USER_THEN_ACTIONS:
132 132
            raise forms.ValidationError('This action "%s" is not permitted' %(then[0].action))
133
        existing_routes = Route.objects.exclude(status='EXPIRED').exclude(status='ERROR').exclude(status='ADMININACTIVE')
133
        existing_routes = Route.objects.all()
134 134
        existing_routes = existing_routes.filter(applier__userprofile__peer=peer)
135 135
        if source:
136 136
            source = IPNetwork(source).compressed
......
259 259
            if same_source_nets:
260 260
                raise forms.ValidationError("Detected same sources")
261 261
            rules.append(rule)
262
        raise forms.ValidationError("%s" %rules)
262
        return rules
263 263

  
264 264
RuleFormSet = modelformset_factory(Route, form=RouteForm, formset=MyRuleFormSet)
265 265

  
b/static/js/jquery.formset.js
206 206
    $.fn.formset.defaults = {
207 207
        prefix: 'form',                  // The form prefix for your django formset
208 208
        formTemplate: null,              // The jQuery selection cloned to generate new form instances
209
        addText: 'add another',          // Text for the add link
210
        deleteText: 'remove',            // Text for the delete link
209
        addText: 'Add another rule',          // Text for the add link
210
        deleteText: 'Remove rule',            // Text for the delete link
211 211
        addCssClass: 'add-row',          // CSS class applied to the add link
212 212
        deleteCssClass: 'delete-row',    // CSS class applied to the delete link
213 213
        formCssClass: 'dynamic-form',    // CSS class applied to each form in a formset
214 214
        extraClasses: [],                // Additional CSS classes, which will be applied to each form in turn
215
        keepFieldValues: '',             // jQuery selector for fields whose values should be kept when the form is cloned
215
        keepFieldValues: '[id$="expires"]',             // jQuery selector for fields whose values should be kept when the form is cloned
216 216
        added: null,                     // Function called each time a new form is added
217 217
        removed: null                    // Function called each time a form is deleted
218 218
    };
b/templates/apply_set.html
432 432
					{{ form.then }}
433 433
				</td>
434 434
				<td>
435
                    {{ form.expires }} 
435
                    {{ form.expires }}
436 436
                </td>
437 437
				<td>{{ form.comments }}</td>
438 438
			</tr>
b/urls.py.dist
13 13
    url(r'^fod/?$', 'flowspy.flowspec.views.group_routes', name="group-routes"),
14 14
    url(r'^fod/profile/?$', 'flowspy.flowspec.views.user_profile', name="user-profile"),
15 15
    url(r'^fod/add/?$', 'flowspy.flowspec.views.add_route', name="add-route"),
16
    url(r'^fod/addset/?$', 'flowspy.flowspec.views.add_route_set', name="add-route-set"),
16 17
    #url(r'^fod/addrl/?$', 'flowspy.flowspec.views.add_rate_limit', name="add-rate-limit"),
17 18
    url(r'^fod/addport/?$', 'flowspy.flowspec.views.add_port', name="add-port"),
18 19
    url(r'^fod/edit/(?P<route_slug>[\w\-]+)/$', 'flowspy.flowspec.views.edit_route', name="edit-route"),

Also available in: Unified diff