Example #1
0
def setup():
    user = User.objects.all()[0]
    account = Account(user=user)
    account.save()
    client = Client(name="Beth", user=account)
    client.save()
    alert = Alert(user=account, client=client, term="l", type="l", frequency="50", length=50)
    alert.save()
Example #2
0
def setup_func():
    user = User.objects.all()[0]
    account = Account(user=user)
    account.save()
    client = Client(name="Beth",
                    user=account)
    client.save()

    LamsonState.objects.all().delete()
    q = queue.Queue(email('run/error'))
    q.clear()
    q = queue.Queue(email('run/alerts'))
    q.clear()
Example #3
0
def create(request):
    """
    Create a new client.
    """
    account = request.user.get_profile()
    created = False

    form = CreateClientForm()
    if request.method == "POST":
        form = CreateClientForm(request.POST)
        if form.is_valid():
            name = form.cleaned_data['name']
            client = Client(user=account,
                            name=name)
            client.save()
            return HttpResponseRedirect(reverse('webapp.clients.views.show'))

    return render_to_response('clients/create.html', {
            'form' : form,
            }, context_instance=RequestContext(request))