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 })
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})
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})
def rule_table(request): mypoint = throw_point(request) return render(request, 'table/photo_table.html', {'mypoint': mypoint, 'posts': posts})
def photo_table(request): mypoint = throw_point(request) return render(request, 'table/photo_table.html', {'mypoint': mypoint})
def main(request): mypoint = throw_point(request) return render(request, 'main/main.html', {'mypoint': mypoint})
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')