def archives request year None month None day None caption None post P

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def archives(request, year=None, month=None, day=None, caption=None):
post = Post.objects.filter(posted__year=year, posted__month=month, posted__day=day, caption=caption)[0]
comments = Comment.objects.filter(post=entry.id)
form = CommentsForm(request.POST or None)
if request.method == 'POST':
if form.is_valid():
obj = form.save(commit=False)
obj.post = post
obj.save() # но всё это должно происходить в форме, полюбому
return render_to_response("entry.html", {'entry': entry, 'form': form})