Petey
unread,Sep 8, 2011, 3:33:30 PM9/8/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Is it possible to bind two views to one url adress?
I have a generic view - detail_view and I prepared a form for comments.
Detail_views generates urls by "type", "pk", "slug" fields. Under each publication I'd like to add a form to add my comments model and I dont really know how I could do that.
URL - detail view:
url(r'^(?P<type>[\w\-_]+)/(?P<pk>\d+)/(?P<slug>[\w\-_]+)/$',
DetailView.as_view(
model=Publisher,
template_name='templates/publications/single.html',
),
name = "single_publication"
),
VIEW for form:
def add_comment(request, type, pk, slug):
form = CommentsForm()
return render_to_response('templates/publications/single.html', {'form':form}, context_instance=RequestContext(request))