Esempio n. 1
0
def blog_default(request):
    bloger = Blog.all().filter('url =', 'http://blog.sina.com.cn/sjxxh').get()
    if not bloger:
        bloger = Blog(author = 'Monkeyking',service_provider = 'sina',url = 'http://blog.sina.com.cn/sjxxh')
        bloger.put()
    
    return blog(request, bloger.key())
Esempio n. 2
0
def add_blog(request):
    if request.method == 'POST': # If the form has been submitted...
        form = BlogForm(request.POST) # A form bound to the POST data
        if form.is_valid(): # All validation rules pass
            bloger = Blog(author = form.cleaned_data['author'],service_provider = form.cleaned_data['service_provider'],url = form.cleaned_data['url'])
            bloger.put()
            return redirect('/blog/%s' % bloger.key()) # Redirect after POST
    else:
        form = ContactForm() # An unbound form

    return redirect('/new_blog/')