Re: Attribute error, with a very basic banking app
Thanks for your speedy reply, I've attached the stack trace On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: > > Could you share the full stack trace you get when trying to run the server > ? > The attribute error should come with a ton of information like the > file and the line where the error occur. > > 2016-08-25 16:57 GMT+02:00 Neil Hunt >: > > I've beem working on a simple banking app based on the Django tutorial. > > Thanks to your help it almost works now. It was working using templates > but > > after making some changes to get HttpResponseRedirect to work I changed > what > > was in the urls file like it shows in the tutorial. Now, the server > doesn't > > run. It says there's an attribute error. I've temporarily left the user > name > > and password in at the moment. I had a look at their tutorial how to do > a > > use the Django authentication system (thanks for telling me about that) > and > > I'm going to change that after I understand what's going on here. It's > > amazing how much you can do with Django. Do you think with time you get > more > > used to what different errors mean? The errors seem new and confusing to > me > > at the moment. Any help would be very much appreciated. Thanks in > advnace. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to django-users...@googlegroups.com . > > To post to this group, send email to django...@googlegroups.com > . > > Visit this group at https://groups.google.com/group/django-users. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/b30091ce-fcbf-461e-869e-bba72eb9dcfe%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > > Cordialement, Coues Ludovic > +336 148 743 42 > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b9b247a9-830d-4cc0-a441-5a8013899f13%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. tracext Description: Binary data
Re: Attribute error, with a very basic banking app
The stacktrace is helpful, thanks! The specific message with the AttributeError is helpful here: `AttributeError: 'module' object has no attribute 'DepositView'` The line above it is ` File "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", line 8, in url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` So I checked to see if your views.py contains anything named DepositView...and it does not. That's why the AttributeError is showing up. The `DepositView.as_view()` syntax is suitable for class-based views, which means I expect to see something in your views.py to the effect of: class DepositView(View): def post(self, request, *args, **kwargs): // the logic in your deposit() function actually belongs here Have a look at the class-based views documentation to see what the different classes are, and what options they provide you. Alternately, your urls.py could reference views.deposit (which does exist) instead of views.DepositView (which does not). Hope this helps! On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt wrote: > Thanks for your speedy reply, I've attached the stack trace > > On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: >> >> Could you share the full stack trace you get when trying to run the >> server ? >> The attribute error should come with a ton of information like the >> file and the line where the error occur. >> >> 2016-08-25 16:57 GMT+02:00 Neil Hunt : >> > I've beem working on a simple banking app based on the Django tutorial. >> > Thanks to your help it almost works now. It was working using templates >> but >> > after making some changes to get HttpResponseRedirect to work I changed >> what >> > was in the urls file like it shows in the tutorial. Now, the server >> doesn't >> > run. It says there's an attribute error. I've temporarily left the user >> name >> > and password in at the moment. I had a look at their tutorial how to do >> a >> > use the Django authentication system (thanks for telling me about that) >> and >> > I'm going to change that after I understand what's going on here. It's >> > amazing how much you can do with Django. Do you think with time you get >> more >> > used to what different errors mean? The errors seem new and confusing >> to me >> > at the moment. Any help would be very much appreciated. Thanks in >> advnace. >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Django users" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an >> > email to django-users...@googlegroups.com. >> > To post to this group, send email to django...@googlegroups.com. >> > Visit this group at https://groups.google.com/group/django-users. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msgid/django-users/b30091ce-fcbf >> -461e-869e-bba72eb9dcfe%40googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> >> Cordialement, Coues Ludovic >> +336 148 743 42 >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/b9b247a9-830d-4cc0-a441-5a8013899f13%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/b9b247a9-830d-4cc0-a441-5a8013899f13%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Andromeda Yelton Vice President/President-Elect, Library & Information Technology Association: http://www.lita.org http://andromedayelton.com @ThatAndromeda <http://twitter.com/ThatAndromeda> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFE1XCbjKrqcXNmF2wUZottJLJr37SabJdq5ihZpWGiUiCLNDg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Attribute error, with a very basic banking app
Thank you so much Andromeda. I didn't know you could use class based views. I'll have a look at the documents. I don't know why I was trying to use them when I didn't need to. On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < andromeda.yel...@gmail.com> wrote: > The stacktrace is helpful, thanks! > > The specific message with the AttributeError is helpful here: > `AttributeError: 'module' object has no attribute 'DepositView'` > > The line above it is ` File "/home/soupdragon/DJapps/ > banking/mybank/banking/urls.py", line 8, in > url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` > > So I checked to see if your views.py contains anything named > DepositView...and it does not. That's why the AttributeError is showing up. > > The `DepositView.as_view()` syntax is suitable for class-based views, > which means I expect to see something in your views.py to the effect of: > > class DepositView(View): > def post(self, request, *args, **kwargs): > // the logic in your deposit() function actually belongs here > > Have a look at the class-based views documentation to see what the > different classes are, and what options they provide you. > > Alternately, your urls.py could reference views.deposit (which does exist) > instead of views.DepositView (which does not). > > Hope this helps! > > On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt wrote: > >> Thanks for your speedy reply, I've attached the stack trace >> >> On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: >>> >>> Could you share the full stack trace you get when trying to run the >>> server ? >>> The attribute error should come with a ton of information like the >>> file and the line where the error occur. >>> >>> 2016-08-25 16:57 GMT+02:00 Neil Hunt : >>> > I've beem working on a simple banking app based on the Django >>> tutorial. >>> > Thanks to your help it almost works now. It was working using >>> templates but >>> > after making some changes to get HttpResponseRedirect to work I >>> changed what >>> > was in the urls file like it shows in the tutorial. Now, the server >>> doesn't >>> > run. It says there's an attribute error. I've temporarily left the >>> user name >>> > and password in at the moment. I had a look at their tutorial how to >>> do a >>> > use the Django authentication system (thanks for telling me about >>> that) and >>> > I'm going to change that after I understand what's going on here. It's >>> > amazing how much you can do with Django. Do you think with time you >>> get more >>> > used to what different errors mean? The errors seem new and confusing >>> to me >>> > at the moment. Any help would be very much appreciated. Thanks in >>> advnace. >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> Groups >>> > "Django users" group. >>> > To unsubscribe from this group and stop receiving emails from it, send >>> an >>> > email to django-users...@googlegroups.com. >>> > To post to this group, send email to django...@googlegroups.com. >>> > Visit this group at https://groups.google.com/group/django-users. >>> > To view this discussion on the web visit >>> > https://groups.google.com/d/msgid/django-users/b30091ce-fcbf >>> -461e-869e-bba72eb9dcfe%40googlegroups.com. >>> > For more options, visit https://groups.google.com/d/optout. >>> >>> >>> >>> -- >>> >>> Cordialement, Coues Ludovic >>> +336 148 743 42 >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/django-users/b9b247a9-830d-4cc0-a441-5a8013899f13%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/b9b247a9-830d-4cc0-a441-5a8013899f13%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://gro
Re: Attribute error, with a very basic banking app
Hello Neil, It is nota problem to use Class based view. Could you please update your views.py with next code. Look like you would like to have detail of the deposit in this case add next string to the header from django.views.generic import DetailView from models import Account1, Person # next you should create a special view class for each Account1 class Deposit(DetailView): model = Account1 Of course function Deposit is useless thats all. P.S. Look like better way is adding auth and receive person using auth data. In this case every authorized person can connect to his account using auth info and account id Many thanks, Serge +380 636150445 skype: skhohlov On Thu, Aug 25, 2016 at 8:27 PM, Neil Hunt wrote: > Thank you so much Andromeda. I didn't know you could use class based > views. I'll have a look at the documents. I don't know why I was trying to > use them when I didn't need to. > > On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < > andromeda.yel...@gmail.com> wrote: > >> The stacktrace is helpful, thanks! >> >> The specific message with the AttributeError is helpful here: >> `AttributeError: 'module' object has no attribute 'DepositView'` >> >> The line above it is ` File >> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >> line 8, in >> url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` >> >> So I checked to see if your views.py contains anything named >> DepositView...and it does not. That's why the AttributeError is showing up. >> >> The `DepositView.as_view()` syntax is suitable for class-based views, >> which means I expect to see something in your views.py to the effect of: >> >> class DepositView(View): >> def post(self, request, *args, **kwargs): >> // the logic in your deposit() function actually belongs here >> >> Have a look at the class-based views documentation to see what the >> different classes are, and what options they provide you. >> >> Alternately, your urls.py could reference views.deposit (which does >> exist) instead of views.DepositView (which does not). >> >> Hope this helps! >> >> On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt wrote: >> >>> Thanks for your speedy reply, I've attached the stack trace >>> >>> On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: >>>> >>>> Could you share the full stack trace you get when trying to run the >>>> server ? >>>> The attribute error should come with a ton of information like the >>>> file and the line where the error occur. >>>> >>>> 2016-08-25 16:57 GMT+02:00 Neil Hunt : >>>> > I've beem working on a simple banking app based on the Django >>>> tutorial. >>>> > Thanks to your help it almost works now. It was working using >>>> templates but >>>> > after making some changes to get HttpResponseRedirect to work I >>>> changed what >>>> > was in the urls file like it shows in the tutorial. Now, the server >>>> doesn't >>>> > run. It says there's an attribute error. I've temporarily left the >>>> user name >>>> > and password in at the moment. I had a look at their tutorial how to >>>> do a >>>> > use the Django authentication system (thanks for telling me about >>>> that) and >>>> > I'm going to change that after I understand what's going on here. >>>> It's >>>> > amazing how much you can do with Django. Do you think with time you >>>> get more >>>> > used to what different errors mean? The errors seem new and confusing >>>> to me >>>> > at the moment. Any help would be very much appreciated. Thanks in >>>> advnace. >>>> > >>>> > -- >>>> > You received this message because you are subscribed to the Google >>>> Groups >>>> > "Django users" group. >>>> > To unsubscribe from this group and stop receiving emails from it, >>>> send an >>>> > email to django-users...@googlegroups.com. >>>> > To post to this group, send email to django...@googlegroups.com. >>>> > Visit this group at https://groups.google.com/group/django-users. >>>> > To view this discussion on the web visit >>>> > https://groups.google.com/d/msgid/django-users/b30091ce-fcbf >
Re: Attribute error, with a very basic banking app
Hello Serge, I can't believe that's all I have to add to get the class based views to work. It seems easier to get it to work than I thought it would be. Now that you've explained it. Thank you so much for that. Kind regards, Neil On Fri, Aug 26, 2016 at 11:46 AM, Sergiy Khohlov wrote: > Hello Neil, > > It is nota problem to use Class based view. Could you please update > your views.py with next code. > Look like you would like to have detail of the deposit in this case add > next string to the header > > from django.views.generic import DetailView > from models import Account1, Person > > > # next you should create a special view class for each Account1 > > > class Deposit(DetailView): > model = Account1 > > > Of course function Deposit is useless > > thats all. > > > P.S. Look like better way is adding auth and receive person using auth > data. In this case every authorized person can connect to his account > using auth info and account id > > Many thanks, > > Serge > > > +380 636150445 > skype: skhohlov > > On Thu, Aug 25, 2016 at 8:27 PM, Neil Hunt wrote: > >> Thank you so much Andromeda. I didn't know you could use class based >> views. I'll have a look at the documents. I don't know why I was trying to >> use them when I didn't need to. >> >> On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < >> andromeda.yel...@gmail.com> wrote: >> >>> The stacktrace is helpful, thanks! >>> >>> The specific message with the AttributeError is helpful here: >>> `AttributeError: 'module' object has no attribute 'DepositView'` >>> >>> The line above it is ` File >>> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >>> line 8, in >>> url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` >>> >>> So I checked to see if your views.py contains anything named >>> DepositView...and it does not. That's why the AttributeError is showing up. >>> >>> The `DepositView.as_view()` syntax is suitable for class-based views, >>> which means I expect to see something in your views.py to the effect of: >>> >>> class DepositView(View): >>> def post(self, request, *args, **kwargs): >>> // the logic in your deposit() function actually belongs here >>> >>> Have a look at the class-based views documentation to see what the >>> different classes are, and what options they provide you. >>> >>> Alternately, your urls.py could reference views.deposit (which does >>> exist) instead of views.DepositView (which does not). >>> >>> Hope this helps! >>> >>> On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt wrote: >>> >>>> Thanks for your speedy reply, I've attached the stack trace >>>> >>>> On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: >>>>> >>>>> Could you share the full stack trace you get when trying to run the >>>>> server ? >>>>> The attribute error should come with a ton of information like the >>>>> file and the line where the error occur. >>>>> >>>>> 2016-08-25 16:57 GMT+02:00 Neil Hunt : >>>>> > I've beem working on a simple banking app based on the Django >>>>> tutorial. >>>>> > Thanks to your help it almost works now. It was working using >>>>> templates but >>>>> > after making some changes to get HttpResponseRedirect to work I >>>>> changed what >>>>> > was in the urls file like it shows in the tutorial. Now, the server >>>>> doesn't >>>>> > run. It says there's an attribute error. I've temporarily left the >>>>> user name >>>>> > and password in at the moment. I had a look at their tutorial how to >>>>> do a >>>>> > use the Django authentication system (thanks for telling me about >>>>> that) and >>>>> > I'm going to change that after I understand what's going on here. >>>>> It's >>>>> > amazing how much you can do with Django. Do you think with time you >>>>> get more >>>>> > used to what different errors mean? The errors seem new and >>>>> confusing to me >>>>> > at the moment. Any help would be very much appreciated. T
Re: Attribute error, with a very basic banking app
Never mind. Few year ago I was thinking that moving to CBV is bad idea, but suddenly BUUUHHH !! in my head and everything was clear. Many thanks, Serge +380 636150445 skype: skhohlov On Fri, Aug 26, 2016 at 3:40 PM, Neil Hunt wrote: > Hello Serge, > > I can't believe that's all I have to add to get the class based views to > work. It seems easier to get it to work than I thought it would be. Now > that you've explained it. Thank you so much for that. > > Kind regards, > > Neil > > On Fri, Aug 26, 2016 at 11:46 AM, Sergiy Khohlov > wrote: > >> Hello Neil, >> >> It is nota problem to use Class based view. Could you please update >> your views.py with next code. >> Look like you would like to have detail of the deposit in this case add >> next string to the header >> >> from django.views.generic import DetailView >> from models import Account1, Person >> >> >> # next you should create a special view class for each Account1 >> >> >> class Deposit(DetailView): >> model = Account1 >> >> >> Of course function Deposit is useless >> >> thats all. >> >> >> P.S. Look like better way is adding auth and receive person using auth >> data. In this case every authorized person can connect to his account >> using auth info and account id >> >> Many thanks, >> >> Serge >> >> >> +380 636150445 >> skype: skhohlov >> >> On Thu, Aug 25, 2016 at 8:27 PM, Neil Hunt wrote: >> >>> Thank you so much Andromeda. I didn't know you could use class based >>> views. I'll have a look at the documents. I don't know why I was trying to >>> use them when I didn't need to. >>> >>> On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < >>> andromeda.yel...@gmail.com> wrote: >>> >>>> The stacktrace is helpful, thanks! >>>> >>>> The specific message with the AttributeError is helpful here: >>>> `AttributeError: 'module' object has no attribute 'DepositView'` >>>> >>>> The line above it is ` File >>>> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >>>> line 8, in >>>> url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` >>>> >>>> So I checked to see if your views.py contains anything named >>>> DepositView...and it does not. That's why the AttributeError is showing up. >>>> >>>> The `DepositView.as_view()` syntax is suitable for class-based views, >>>> which means I expect to see something in your views.py to the effect of: >>>> >>>> class DepositView(View): >>>> def post(self, request, *args, **kwargs): >>>> // the logic in your deposit() function actually belongs here >>>> >>>> Have a look at the class-based views documentation to see what the >>>> different classes are, and what options they provide you. >>>> >>>> Alternately, your urls.py could reference views.deposit (which does >>>> exist) instead of views.DepositView (which does not). >>>> >>>> Hope this helps! >>>> >>>> On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt >>>> wrote: >>>> >>>>> Thanks for your speedy reply, I've attached the stack trace >>>>> >>>>> On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: >>>>>> >>>>>> Could you share the full stack trace you get when trying to run the >>>>>> server ? >>>>>> The attribute error should come with a ton of information like the >>>>>> file and the line where the error occur. >>>>>> >>>>>> 2016-08-25 16:57 GMT+02:00 Neil Hunt : >>>>>> > I've beem working on a simple banking app based on the Django >>>>>> tutorial. >>>>>> > Thanks to your help it almost works now. It was working using >>>>>> templates but >>>>>> > after making some changes to get HttpResponseRedirect to work I >>>>>> changed what >>>>>> > was in the urls file like it shows in the tutorial. Now, the server >>>>>> doesn't >>>>>> > run. It says there's an attribute error. I've temporarily left the >>>>>> user name >
Re: Attribute error, with a very basic banking app
heh heh. I don't fully appreciate the usefulness of CBV at the moment. Getting a simple example working helps as much as reading the tutorial. Thanks again for your help, Neil On Fri, Aug 26, 2016 at 2:24 PM, Sergiy Khohlov wrote: > Never mind. > Few year ago I was thinking that moving to CBV is bad idea, but suddenly > BUUUHHH !! in my head and everything was clear. > > Many thanks, > > Serge > > > +380 636150445 > skype: skhohlov > > On Fri, Aug 26, 2016 at 3:40 PM, Neil Hunt wrote: > >> Hello Serge, >> >> I can't believe that's all I have to add to get the class based views to >> work. It seems easier to get it to work than I thought it would be. Now >> that you've explained it. Thank you so much for that. >> >> Kind regards, >> >> Neil >> >> On Fri, Aug 26, 2016 at 11:46 AM, Sergiy Khohlov >> wrote: >> >>> Hello Neil, >>> >>> It is nota problem to use Class based view. Could you please update >>> your views.py with next code. >>> Look like you would like to have detail of the deposit in this case >>> add next string to the header >>> >>> from django.views.generic import DetailView >>> from models import Account1, Person >>> >>> >>> # next you should create a special view class for each Account1 >>> >>> >>> class Deposit(DetailView): >>> model = Account1 >>> >>> >>> Of course function Deposit is useless >>> >>> thats all. >>> >>> >>> P.S. Look like better way is adding auth and receive person using auth >>> data. In this case every authorized person can connect to his account >>> using auth info and account id >>> >>> Many thanks, >>> >>> Serge >>> >>> >>> +380 636150445 >>> skype: skhohlov >>> >>> On Thu, Aug 25, 2016 at 8:27 PM, Neil Hunt wrote: >>> >>>> Thank you so much Andromeda. I didn't know you could use class based >>>> views. I'll have a look at the documents. I don't know why I was trying to >>>> use them when I didn't need to. >>>> >>>> On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < >>>> andromeda.yel...@gmail.com> wrote: >>>> >>>>> The stacktrace is helpful, thanks! >>>>> >>>>> The specific message with the AttributeError is helpful here: >>>>> `AttributeError: 'module' object has no attribute 'DepositView'` >>>>> >>>>> The line above it is ` File >>>>> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >>>>> line 8, in >>>>> url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` >>>>> >>>>> So I checked to see if your views.py contains anything named >>>>> DepositView...and it does not. That's why the AttributeError is showing >>>>> up. >>>>> >>>>> The `DepositView.as_view()` syntax is suitable for class-based views, >>>>> which means I expect to see something in your views.py to the effect of: >>>>> >>>>> class DepositView(View): >>>>> def post(self, request, *args, **kwargs): >>>>> // the logic in your deposit() function actually belongs here >>>>> >>>>> Have a look at the class-based views documentation to see what the >>>>> different classes are, and what options they provide you. >>>>> >>>>> Alternately, your urls.py could reference views.deposit (which does >>>>> exist) instead of views.DepositView (which does not). >>>>> >>>>> Hope this helps! >>>>> >>>>> On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt >>>>> wrote: >>>>> >>>>>> Thanks for your speedy reply, I've attached the stack trace >>>>>> >>>>>> On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues wrote: >>>>>>> >>>>>>> Could you share the full stack trace you get when trying to run the >>>>>>> server ? >>>>>>> The attribute error should come with a ton of information like the >>>>>>> file and the line where the error occur. >>>>>>> >>>>>>> 2016
Re: Attribute error, with a very basic banking app
In my experience, CBVs are useful when the view you want to write is basically a create, read, update, or delete operation on a single database item, or a bunch of instances of the same model (...and it turns out a lot of web app pages are just that). And they're useful because they let you do that with almost no lines of code - they take care of all the things you'd have to write over and over, and let you focus on the things that are unique to your use case. The farther away your business logic is from that, the more you need to understand the actual methods available and the inheritance tree and so forth. It took me a while to get over this hurdle too, but now that I have I use CBVs exclusively. On Fri, Aug 26, 2016 at 10:13 AM, Neil Hunt wrote: > heh heh. I don't fully appreciate the usefulness of CBV at the moment. > Getting a simple example working helps as much as reading the tutorial. > Thanks again for your help, > > Neil > > On Fri, Aug 26, 2016 at 2:24 PM, Sergiy Khohlov > wrote: > >> Never mind. >> Few year ago I was thinking that moving to CBV is bad idea, but >> suddenly BUUUHHH !! in my head and everything was clear. >> >> Many thanks, >> >> Serge >> >> >> +380 636150445 >> skype: skhohlov >> >> On Fri, Aug 26, 2016 at 3:40 PM, Neil Hunt wrote: >> >>> Hello Serge, >>> >>> I can't believe that's all I have to add to get the class based views to >>> work. It seems easier to get it to work than I thought it would be. Now >>> that you've explained it. Thank you so much for that. >>> >>> Kind regards, >>> >>> Neil >>> >>> On Fri, Aug 26, 2016 at 11:46 AM, Sergiy Khohlov >>> wrote: >>> >>>> Hello Neil, >>>> >>>> It is nota problem to use Class based view. Could you please update >>>> your views.py with next code. >>>> Look like you would like to have detail of the deposit in this case >>>> add next string to the header >>>> >>>> from django.views.generic import DetailView >>>> from models import Account1, Person >>>> >>>> >>>> # next you should create a special view class for each Account1 >>>> >>>> >>>> class Deposit(DetailView): >>>> model = Account1 >>>> >>>> >>>> Of course function Deposit is useless >>>> >>>> thats all. >>>> >>>> >>>> P.S. Look like better way is adding auth and receive person using >>>> auth data. In this case every authorized person can connect to his >>>> account using auth info and account id >>>> >>>> Many thanks, >>>> >>>> Serge >>>> >>>> >>>> +380 636150445 >>>> skype: skhohlov >>>> >>>> On Thu, Aug 25, 2016 at 8:27 PM, Neil Hunt wrote: >>>> >>>>> Thank you so much Andromeda. I didn't know you could use class based >>>>> views. I'll have a look at the documents. I don't know why I was trying to >>>>> use them when I didn't need to. >>>>> >>>>> On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < >>>>> andromeda.yel...@gmail.com> wrote: >>>>> >>>>>> The stacktrace is helpful, thanks! >>>>>> >>>>>> The specific message with the AttributeError is helpful here: >>>>>> `AttributeError: 'module' object has no attribute 'DepositView'` >>>>>> >>>>>> The line above it is ` File >>>>>> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >>>>>> line 8, in >>>>>> url(r'^deposit/$', views.DepositView.as_view(), name='deposit'),` >>>>>> >>>>>> So I checked to see if your views.py contains anything named >>>>>> DepositView...and it does not. That's why the AttributeError is showing >>>>>> up. >>>>>> >>>>>> The `DepositView.as_view()` syntax is suitable for class-based views, >>>>>> which means I expect to see something in your views.py to the effect of: >>>>>> >>>>>> class DepositView(View): >>>>>> def post(self, request, *args, **kwargs): >>>>>> // the logic in your deposit() function actu
Re: Attribute error, with a very basic banking app
On Fri, Aug 26, 2016 at 10:29:16AM -0400, Andromeda Yelton wrote: > In my experience, CBVs are useful when the view you want to write is > basically a create, read, update, or delete operation on a single database > item, or a bunch of instances of the same model (...and it turns out a lot > of web app pages are just that). And they're useful because they let you do > that with almost no lines of code - they take care of all the things you'd > have to write over and over, and let you focus on the things that are > unique to your use case. > > The farther away your business logic is from that, the more you need to > understand the actual methods available and the inheritance tree and so > forth. It took me a while to get over this hurdle too, but now that I have > I use CBVs exclusively. I'll just chime in with a reference to http://ccbv.co.uk/, which is an invaluable resource whenever you're doing anything with CBVs that involves more than setting the ``template_name`` and ``model`` attributes. In my opinion, CCBV makes a lot of the pain involved in dealing with CBVs go away. Cheers, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160826144853.GA6601%40konk.org. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
Re: Attribute error, with a very basic banking app
I've read the tutorial but I didn't fully appreciate how useful CBV are. Amazing as well that sometimes you can write almost no code. Thanks a lot for explaining that. On Fri, Aug 26, 2016 at 3:29 PM, Andromeda Yelton < andromeda.yel...@gmail.com> wrote: > In my experience, CBVs are useful when the view you want to write is > basically a create, read, update, or delete operation on a single database > item, or a bunch of instances of the same model (...and it turns out a lot > of web app pages are just that). And they're useful because they let you do > that with almost no lines of code - they take care of all the things you'd > have to write over and over, and let you focus on the things that are > unique to your use case. > > The farther away your business logic is from that, the more you need to > understand the actual methods available and the inheritance tree and so > forth. It took me a while to get over this hurdle too, but now that I have > I use CBVs exclusively. > > On Fri, Aug 26, 2016 at 10:13 AM, Neil Hunt wrote: > >> heh heh. I don't fully appreciate the usefulness of CBV at the moment. >> Getting a simple example working helps as much as reading the tutorial. >> Thanks again for your help, >> >> Neil >> >> On Fri, Aug 26, 2016 at 2:24 PM, Sergiy Khohlov >> wrote: >> >>> Never mind. >>> Few year ago I was thinking that moving to CBV is bad idea, but >>> suddenly BUUUHHH !! in my head and everything was clear. >>> >>> Many thanks, >>> >>> Serge >>> >>> >>> +380 636150445 >>> skype: skhohlov >>> >>> On Fri, Aug 26, 2016 at 3:40 PM, Neil Hunt wrote: >>> >>>> Hello Serge, >>>> >>>> I can't believe that's all I have to add to get the class based views >>>> to work. It seems easier to get it to work than I thought it would be. Now >>>> that you've explained it. Thank you so much for that. >>>> >>>> Kind regards, >>>> >>>> Neil >>>> >>>> On Fri, Aug 26, 2016 at 11:46 AM, Sergiy Khohlov >>>> wrote: >>>> >>>>> Hello Neil, >>>>> >>>>> It is nota problem to use Class based view. Could you please update >>>>> your views.py with next code. >>>>> Look like you would like to have detail of the deposit in this case >>>>> add next string to the header >>>>> >>>>> from django.views.generic import DetailView >>>>> from models import Account1, Person >>>>> >>>>> >>>>> # next you should create a special view class for each Account1 >>>>> >>>>> >>>>> class Deposit(DetailView): >>>>> model = Account1 >>>>> >>>>> >>>>> Of course function Deposit is useless >>>>> >>>>> thats all. >>>>> >>>>> >>>>> P.S. Look like better way is adding auth and receive person using >>>>> auth data. In this case every authorized person can connect to his >>>>> account using auth info and account id >>>>> >>>>> Many thanks, >>>>> >>>>> Serge >>>>> >>>>> >>>>> +380 636150445 >>>>> skype: skhohlov >>>>> >>>>> On Thu, Aug 25, 2016 at 8:27 PM, Neil Hunt >>>>> wrote: >>>>> >>>>>> Thank you so much Andromeda. I didn't know you could use class based >>>>>> views. I'll have a look at the documents. I don't know why I was trying >>>>>> to >>>>>> use them when I didn't need to. >>>>>> >>>>>> On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < >>>>>> andromeda.yel...@gmail.com> wrote: >>>>>> >>>>>>> The stacktrace is helpful, thanks! >>>>>>> >>>>>>> The specific message with the AttributeError is helpful here: >>>>>>> `AttributeError: 'module' object has no attribute 'DepositView'` >>>>>>> >>>>>>> The line above it is ` File >>>>>>> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >>>>>>> line 8, in >>>>>>> url(r'^d
Re: Attribute error, with a very basic banking app
t;>>>> >>>>>>> On Thu, Aug 25, 2016 at 4:23 PM, Andromeda Yelton < >>>>>>> andromeda.yel...@gmail.com> wrote: >>>>>>> >>>>>>>> The stacktrace is helpful, thanks! >>>>>>>> >>>>>>>> The specific message with the AttributeError is helpful here: >>>>>>>> `AttributeError: 'module' object has no attribute 'DepositView'` >>>>>>>> >>>>>>>> The line above it is ` File >>>>>>>> "/home/soupdragon/DJapps/banking/mybank/banking/urls.py", >>>>>>>> line 8, in >>>>>>>> url(r'^deposit/$', views.DepositView.as_view(), >>>>>>>> name='deposit'),` >>>>>>>> >>>>>>>> So I checked to see if your views.py contains anything named >>>>>>>> DepositView...and it does not. That's why the AttributeError is >>>>>>>> showing up. >>>>>>>> >>>>>>>> The `DepositView.as_view()` syntax is suitable for class-based >>>>>>>> views, which means I expect to see something in your views.py to the >>>>>>>> effect >>>>>>>> of: >>>>>>>> >>>>>>>> class DepositView(View): >>>>>>>> def post(self, request, *args, **kwargs): >>>>>>>> // the logic in your deposit() function actually belongs here >>>>>>>> >>>>>>>> Have a look at the class-based views documentation to see what the >>>>>>>> different classes are, and what options they provide you. >>>>>>>> >>>>>>>> Alternately, your urls.py could reference views.deposit (which does >>>>>>>> exist) instead of views.DepositView (which does not). >>>>>>>> >>>>>>>> Hope this helps! >>>>>>>> >>>>>>>> On Thu, Aug 25, 2016 at 11:14 AM, Neil Hunt >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Thanks for your speedy reply, I've attached the stack trace >>>>>>>>> >>>>>>>>> On Thursday, August 25, 2016 at 4:00:16 PM UTC+1, ludovic coues >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Could you share the full stack trace you get when trying to run >>>>>>>>>> the server ? >>>>>>>>>> The attribute error should come with a ton of information like >>>>>>>>>> the >>>>>>>>>> file and the line where the error occur. >>>>>>>>>> >>>>>>>>>> 2016-08-25 16:57 GMT+02:00 Neil Hunt : >>>>>>>>>> > I've beem working on a simple banking app based on the Django >>>>>>>>>> tutorial. >>>>>>>>>> > Thanks to your help it almost works now. It was working using >>>>>>>>>> templates but >>>>>>>>>> > after making some changes to get HttpResponseRedirect to work I >>>>>>>>>> changed what >>>>>>>>>> > was in the urls file like it shows in the tutorial. Now, the >>>>>>>>>> server doesn't >>>>>>>>>> > run. It says there's an attribute error. I've temporarily left >>>>>>>>>> the user name >>>>>>>>>> > and password in at the moment. I had a look at their tutorial >>>>>>>>>> how to do a >>>>>>>>>> > use the Django authentication system (thanks for telling me >>>>>>>>>> about that) and >>>>>>>>>> > I'm going to change that after I understand what's going on >>>>>>>>>> here. It's >>>>>>>>>> > amazing how much you can do with Django. Do you think with time >>>>>>>>>> you get more >>>>>>>>>> > used to what different errors mean? The errors seem new and >>>>>>>>>> confusing to me >>>>>>>>>> >
Re: Attribute error, with a very basic banking app
Thanks for that Michal, I see what you mean. I've bookmarked it. Thanks to everyone for all the detailed replies it really helps make sense of CBV :) On Fri, Aug 26, 2016 at 3:48 PM, Michal Petrucha < michal.petru...@konk.org> wrote: > On Fri, Aug 26, 2016 at 10:29:16AM -0400, Andromeda Yelton wrote: > > In my experience, CBVs are useful when the view you want to write is > > basically a create, read, update, or delete operation on a single > database > > item, or a bunch of instances of the same model (...and it turns out a > lot > > of web app pages are just that). And they're useful because they let you > do > > that with almost no lines of code - they take care of all the things > you'd > > have to write over and over, and let you focus on the things that are > > unique to your use case. > > > > The farther away your business logic is from that, the more you need to > > understand the actual methods available and the inheritance tree and so > > forth. It took me a while to get over this hurdle too, but now that I > have > > I use CBVs exclusively. > > I'll just chime in with a reference to http://ccbv.co.uk/, which is an > invaluable resource whenever you're doing anything with CBVs that > involves more than setting the ``template_name`` and ``model`` > attributes. In my opinion, CCBV makes a lot of the pain involved in > dealing with CBVs go away. > > Cheers, > > Michal > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/django-users/vXAou_bCuhE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/20160826144853.GA6601%40konk.org. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACaWuFT1cL7jmsUbmj3g%3Dskp9HK5VtunWxSx8i9M8%2BAqOF2yzg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Weird??!! Attribute Error on Page but not in Shell
Hi all, This is very strange. I am getting an " ArrributeError no attribute named get_list" in the browser, but when I import the model in the shell, get_list works fine. I wonder how I can solve this. The rest of my site and models work fine. Grateful for any assistance. I kind of need to get this app up is a ASAP. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Attribute Error: 'None Type' object has no attribute 'split'
Using reverse to shortcut URLs, addressing compatibilities of sorts although am running the following; dj-database-url==0.5.0 Django==2.1.4 django-crispy-forms==1.7.2 gunicorn==19.9.0 mysqlclient==1.3.14 Pillow==5.3.0 psycopg2==2.7.6.1 pytz==2018.7 My problem is that now my "detail" isn't working. What do I have to do, please, to get the details working? **Link in template: {% for obj in object_list %} {{ obj }} {{ obj.name }} {{ obj.location }} {{ obj.category }} {{ obj.timestamp }} {{ obj.updated }} {% endfor %} *URL in App: from django.conf.urls import url from restaurants.views import ( # restaurant_createview, # restaurant_listview, RestaurantListView, RestaurantDetailView, RestaurantCreateView ) app_name = 'restaurants' urlpatterns = [ url(r'$', RestaurantListView.as_view(), name='list'), url(r'^create/$', RestaurantCreateView.as_view(), name='create'), # RestaurantCreateView.as_view()), url(r'^(?P[\w-]+)/$', RestaurantDetailView.as_view(), name='detail'), ] *Main URLs from django.conf.urls import url, include from django.contrib import admin from django.views.generic import TemplateView from django.contrib.auth.views import LoginView from restaurants.views import ( restaurant_createview, restaurant_listview, RestaurantListView, RestaurantDetailView, RestaurantCreateView ) urlpatterns = [ url('admin/', admin.site.urls), url(r'^$', TemplateView.as_view(template_name = 'home.html'), name='home'), url(r'^login/$', LoginView.as_view(), name='login'), url('restaurants/', include('restaurants.urls', namespace='restaurants')), url(r'^about/$', TemplateView.as_view(template_name = 'about.html'), name='about'), url(r'^contact/$', TemplateView.as_view(template_name = 'contact.html'), name='contact'), ] **Model from django.conf import settings from django.db import models from django.db.models.signals import pre_save, post_save from django.urls import reverse from .utils import unique_slug_generator from .validators import validate_category User = settings.AUTH_USER_MODEL class RestaurantLocation(models.Model): owner = models.ForeignKey(User, on_delete=models.CASCADE) # class_instance.model_set.all # check out - Django Models Unleashed JOINCFE.com name = models.CharField(max_length=120) location = models.CharField(max_length=120, null=True, blank=True) category = models.CharField(max_length=120, null=True, blank=True, validators=[validate_category]) timestamp = models.DateTimeField(auto_now_add=True) updated= models.DateTimeField(auto_now=True) slug = models.SlugField(null=True, blank=True) def __str__(self): return self.name def get_absolute_url(self): #get_absolute_url #return f"/restaurants/{self.slug}" Removed in order to use reverse - url resolvers return reverse('restaurants:detail', kwargs={'slug': self.slug}) #changed from restaurants-detailto us the restaurants namespace @property def title(self): return self.name #object.title def rl_pre_save_receiver(sender, instance, *args, **kwargs): instance.category = instance.category.capitalize() if not instance.slug: instance.slug = unique_slug_generator(instance) #def rl_post_save_receiver(sender, instance, created, *args, **kwargs): # print('saved') # print(instance.timestamp) # if not instance.slug: # instance.slug = unique_slug_generator(instance) #instance.save() pre_save.connect(rl_pre_save_receiver, sender=RestaurantLocation) #pre_save.connect(rl_post_save_receiver, sender=RestaurantLocation) **Views from django.contrib.auth.decorators import login_required # login decorator, forces u to login before u see form! from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import Q from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from django.views import View from django.views.generic import TemplateView, ListView, DetailView, CreateView from .forms import RestaurantCreateForm, RestaurantLocationCreateForm from .models import RestaurantLocation # Create your views here. # class based view @login_required() def restaurant_createview(request): form = RestaurantLocationCreateForm(request.POST or None) errors = None if form.is_valid(): # form.save() --- This is done by default in this FBV if request.user.is_authenticated: instance = form.save(commit=False) # customise # like a pre_save instance.owner = request.user # User is of AnonymousUser classif not logged in instance.save() # like a post_save return HttpResponseRedirect("/restaurants/") else: return HttpResponseRed
Re: Weird??!! Attribute Error on Page but not in Shell
Why don't you post some code? Nothing is obvious from what you've said -rob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
'module' object has no attribute 'TabularInLine' Attribute Error in Django 1
I'm trying to upgrade my skills from django 096 to 1.0 so I started a new app and tried to create an admin class for a class within its model. I got the error I specified in the subject. I paste down the traceback .Can you help me? Environment: Request Method: GET Request URL: http://localhost:8000/admin/ Django Version: 1.0-final-SVN-unknown Python Version: 2.5.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.admindocs', 'retailcenter.publicsite'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.locale.LocaleMiddleware') Traceback: File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in get_response 77. request.path_info) File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py" in resolve 178. for pattern in self.urlconf_module.urlpatterns: File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py" in _get_urlconf_module 197. self._urlconf_module = __import__(self.urlconf_name, {}, {}, ['']) File "C:\Django-1.0\retailcenter\..\retailcenter\urls.py" in 5. admin.autodiscover() File "C:\Python25\Lib\site-packages\django\contrib\admin\__init__.py" in autodiscover 40. __import__("%s.admin" % app) File "C:\Django-1.0\retailcenter\publicsite\admin.py" in 22. class DocumentoInLine(admin.TabularInLine): Exception Type: AttributeError at /admin/ Exception Value: 'module' object has no attribute 'TabularInLine' --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 'module' object has no attribute 'TabularInLine' Attribute Error in Django 1
Thanks for being dumb TeenSpirit83, i've just spent 30mins trying to fix exactly the same typo...small world. On Sep 11, 2:56 pm, TeenSpirit83 <[EMAIL PROTECTED]> wrote: > > The L in Inline should not be capitalized. Is it in some doc you are > > working from? > > > Karen > > The docs are correct! > I'm so dumb, it is the first time I notice the L is not capitalized! > I was sure of the opposite! > Thanks a lot Karen! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 'module' object has no attribute 'TabularInLine' Attribute Error in Django 1
On Thu, Sep 11, 2008 at 9:29 AM, TeenSpirit83 <[EMAIL PROTECTED]>wrote: > > I'm trying to upgrade my skills from django 096 to 1.0 so I started a > new app and tried to create an admin class for a class within its > model. > I got the error I specified in the subject. I paste down the > traceback .Can you help me? > > [snipped debug info] The L in Inline should not be capitalized. Is it in some doc you are working from? Karen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 'module' object has no attribute 'TabularInLine' Attribute Error in Django 1
> > The L in Inline should not be capitalized. Is it in some doc you are > working from? > > Karen The docs are correct! I'm so dumb, it is the first time I notice the L is not capitalized! I was sure of the opposite! Thanks a lot Karen! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Generic List View raises Attribute Error: "'function' object has no attribute '_clone'
I've written a simple search function that uses a db model based on the one described in The Django Book tutorial (http:// www.djangobook.com/en/2.0/), using a generic list, and a Paginator. Here is my view function: def search (request): """Search by title or author name""" if 'q' in request.POST and request.POST['q']: query_term = request.POST['q'] context = { } book_list = Book.objects.filter(Q(authors__name__contains=query_term) | Q(title__contains=query_term)) if len(book_list) == 0: context['message'] = 'No matches found' book_list = Book.objects.all() # Book.objects.filter(Q(available=True)) also works paginator = Paginator(book_list, 10) # Show 10 books per page try: page = int(request.GET.get('page', '1')) except ValueError: page = 1 try: books = paginator.page(page) except (EmptyPage, InvalidPage): books = paginator.page(paginator.num_pages) shopping_cart_count = 0 if "cart" in request.session: shopping_cart_count = len(request.session['cart']) context['shopping_cart'] = shopping_cart_count return list_detail.object_list(request, queryset=books, template_name='book_list.html', extra_context=context) When there no matches for the query_term are found, the book_list is simply Book.objects.all(), and the template is rendered correctly. When, however, the query_term matches, I get this error: Attribute Error: "'function' object has no attribute '_clone' Supposedly, this is because the filtering does not produce a proper QuerySet, which in turn, cannot be cloned by the generic view. If, however, I change the no matches QuerySet from Book.objects.all() to Book.objects.filter(Q(available=True)), the generic view works. Both of the solutions I found suggest creating a new class which builds a proper QuerySet from multiple filter lists (http:// djangosnippets.org/snippets/1103/ and http://stackoverflow.com/questions/431628/how-to-combine-2-or-more-querysets-in-a-django-view/432666#432666), but even using those gave me the same result. I also tried removing the Q(authors__name__contains=query_term) filter on Book, since authors is a ManyToMany relation, but that gave me the same result as well. Any suggestions? -- 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.