does this work? ... (r"magasin/(?P<magasin_id>\d+)/evenement/new/$",EvenementCreateView.as_view(model=Evenement,)), ...
I haven’t used Class based Views yet, but everytime they show up in the docs it is always without using the url function and giving a name. So this is just a wild guess. It seems like it is interpreting EvenementCreateView as a view function not as a class and does not let you call as_view. The error happens always because django looks at all the urls you configured in order to know which one to use, this is why it always crashes. On Nov 23, 2011, at 12:03 , youpsla wrote: > Hello, > the issue here seems to be trivial, maybe I got something in my eyes, > but I can't find the solution. > > Here is my code: > > urls.py > url(r"magasin/(?P<magasin_id>\d+)/evenement/new/$", > EvenementCreateView.as_view(model=Evenement), > name='new_evenement_magasin'), > > views.py: > class EvenementCreateView(CreateView): > form_class = EvenementForm > sucess_url = 'user_magasins' > > def dispatch(self, *args, **kwargs): > bla bla bla .... > > def form_valid(self, form): > bl bla bla ..... > return HttpResponseRedirect(self.get_success_url()) > > > What is funny here is whatever url of the site I call, even one which > doesn't use this view I've the error describe in the subject. The > traceback point on the line of the urls.py. > > I'm not python and django proof, but as far I know class blablabla() > define a Class and not a function !!! > > Does someone have an idea here ? > > Regards > > Alain > > -- > 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. > -- 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.