Le 8 oct. 2011 à 16:12, CrabbyPete a écrit : > I am fooling around with django generic class views, and I was > wondering if its possible to actually build class views per item for > example I have the following class view. > > > class TeamView( View, TemplateResponseMixin ): > template_name = 'team.html' > > def get(self, request): > if 'team' in request.GET: > team = Team.objects.get(id = request.GET['team']) > form = TeamForm( instance = team ) > else > team = None > form = TeamForm( ) > > return self.render_to_response({'form':form}) > > def post(self, request): > form = TeamForm(request.POST) > > if not form.is_valid(): > return self.render_to_response({'form': form}) > > .... > > I want to use this class to also delete the team. I love to use a > method by itself by adding > def delete(self,request) > if 'team' in request.GET: > team = Team.objects.get(id = request.GET['team']) > team.delete() > > Is there a way to specify this in url.py and get around the dispatch > for the get? > > Any advise appreciated.
Hi, You have CreateView / UpdateView for that. Regards, Xavier, Linovia. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.