Beispiel #1
0
    def add(self):
        form = SignupForm()
        if request.method == 'POST' and form.validate_on_submit():
            new_entry = form.make_entry()
            new_entry.servers = ServiceSettings.objects.all()
            new_entry.save()
            return jsonify(status='ok'), 200

        return render_template('subscriber/add.html', form=form)
Beispiel #2
0
    def subscriber_add(self, sid):
        form = SignupForm()
        if request.method == 'POST' and form.validate_on_submit():
            server = ServiceSettings.objects(id=sid).first()
            if server:
                new_entry = form.make_entry()
                new_entry.add_server(server)

                server.add_subscriber(new_entry)
                return jsonify(status='ok'), 200

        return render_template('service/subscriber/add.html', form=form)