示例#1
0
def freeTable_new(request):
    if request.method == "POST":
        form = FreeTableForm(request.POST)
        if form.is_valid():
            post = form.save(commit=False)
            post.author = request.user
            post.published_date = timezone.now()
            post.save()
            return redirect('post_detail', pk=post.pk)
    else:
        form = FreeTableForm()

    mypoint = throw_point(request)


    return render(request, 'table/writing.html', {
                'mypoint': mypoint,
                'form': form
            })
示例#2
0
def free_table(request):
    posts = FreeTable.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
    mypoint = throw_point(request)
    return render(request, 'table/free_table.html', {'mypoint': mypoint, 'posts': posts})
示例#3
0
def post_detail(request, pk):
    post = get_object_or_404(FreeTable, pk=pk)
    mypoint = throw_point(request)
    return render(request, 'table/detail.html', {'mypoint': mypoint, 'post': post})
示例#4
0
def rule_table(request):
    mypoint = throw_point(request)
    return render(request, 'table/photo_table.html', {'mypoint': mypoint, 'posts': posts})
示例#5
0
def photo_table(request):
    mypoint = throw_point(request)
    return render(request, 'table/photo_table.html', {'mypoint': mypoint})
示例#6
0
def main(request):
    mypoint = throw_point(request)
    return render(request, 'main/main.html', {'mypoint': mypoint})
示例#7
0
def main(request):
    if request.user.is_active:
        mypoint = throw_point(request)
        return render(request, 'main/main.html', {'mypoint': mypoint})

    return render(request, 'main/main.html')