I have settings form page. If user filled the form once; it must display those values. But if there is no data [first time] I get query error. I need that query, because the form data must be written as related with current user [logged in]. 

here is my view part : 

```
@login_required(login_url='/login/')
def profile_page(request,username):
    query = Profile.objects.get(owner__username = username) ##error!
    if request.method == 'POST':
        form = profile_form(request.POST,instance=query)
        form.save()
        return HttpResponseRedirect('/admin/')
    else:
        form = profile_form(instance=query)

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

```

I think I need to check the model and if it is empty I should do something different.

I am stuck.

Thank you