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 <[email protected]> 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 <[email protected]> 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 < >> [email protected]> 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 <module> >>> 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 <[email protected]> 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 <[email protected]>: >>>>> > 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 [email protected]. >>>>> > To post to this group, send email to [email protected]. >>>>> > 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> 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%40goog >>>> legroups.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 a topic in the >>> Google Groups "Django users" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/to >>> pic/django-users/vXAou_bCuhE/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To post to this group, send email to [email protected]. >>> 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/CAFE1XCbjKrqcXNmF2wUZottJLJr37SabJdq5ihZpWG >>> iUiCLNDg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAFE1XCbjKrqcXNmF2wUZottJLJr37SabJdq5ihZpWGiUiCLNDg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> 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/CACaWuFRc4Ly_X-j1XVJoP4dxh-B7tbMcQvT_ >> Je0u67rtczXRxQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CACaWuFRc4Ly_X-j1XVJoP4dxh-B7tbMcQvT_Je0u67rtczXRxQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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 > [email protected]. > To post to this group, send email to [email protected]. > 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/CADTRxJNOBynghey%3DFi_%3DQzCJsviG%2BW0% > 3Du5VFaTSPwa9YQSjymA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CADTRxJNOBynghey%3DFi_%3DQzCJsviG%2BW0%3Du5VFaTSPwa9YQSjymA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > 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 [email protected]. To post to this group, send email to [email protected]. 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/CACaWuFSoMY7-YThOCZ4PZVNqwv0Ug%2BLBLHvkVnBj%3Dvk68x-VkQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

