Re: Attribute error, with a very basic banking app

2016-08-26 Thread Neil Hunt
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.


Re: Attribute error, with a very basic banking app

2016-08-26 Thread Sergiy Khohlov
I can help with this one. But I m not ready to write code over weekend. It
is a nice to have used django auth model. You can extend it and this can
cut a lot of your code. Early versions had a problem with correct author
model but now situation is better.
Try to catch me at the beginning of the week.

26 серп. 2016 18:03 "Neil Hunt"  пише:

> 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'^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!

>>

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Neil Hunt
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'^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.
>
>>

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Michal Petrucha
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

2016-08-26 Thread Andromeda Yelton
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 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

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Neil Hunt
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-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-user

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Sergiy Khohlov
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
>> > 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.g

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Neil Hunt
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. 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 gro

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Sergiy Khohlov
 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
 -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
>>> 
>>> .
>>>
>>> For more options,

Re: Attribute error, with a very basic banking app

2016-08-25 Thread Neil Hunt
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
>> 
>> .
>>
>> 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 
>
> --
> 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/CAFE1XCbjKrqcXNmF2wUZottJLJr37
> SabJd

Re: Attribute error, with a very basic banking app

2016-08-25 Thread Andromeda Yelton
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
> 
> .
>
> 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 

-- 
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

2016-08-25 Thread Neil Hunt
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

2016-08-25 Thread ludovic coues
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+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/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/CAEuG%2BTa-x_Dq3_JY68WP%3DPAqdR9QG5HQBuN6zX82fzP9eEK4vQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Attribute error, with a very basic banking app

2016-08-25 Thread 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+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/b30091ce-fcbf-461e-869e-bba72eb9dcfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Title: Login
{% load staticfiles %}


 
 





{% csrf_token %}
Your details:

Username:

Password:







from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
#from django.template import loader
from django.views import generic

from .models import Person, Account1

# Create your views here.
def deposit(request):
	selected_rbox = request.POST.get('Account1')
	selected_rbox = request.POST.get('Account2')
	selected_amount = request.POST.get('Amount')
	person = Person
	account1 = Account1
	context = {'account1':account1,'person':person}
	template = loader.get_template('banking/deposit.html')
	return HttpResponse(template.render(context,request))

def hello(request):
	person = Person
	account1 = Account1
	context = {'account1':account1,'person':person}
	#template = loader.get_template('banking/login.html')
	#return HttpResponse(template.render(context,request))
	return render(request, 'banking/login.html')
	#return render(request, 'banking/login.html', {
	#	'person': person,
	#	'error_message': "You didn't select a choice.",
#	})
	
def login(request):
	#account1 = get_object_or_404(Account1) 
	#person = get_object_or_404(Person) 
	account1 = Account1
	person = Person 
	try:
		selected_login = request.POST.get('login')
		selected_username = request.POST.get('username')
		#selected_login = person.choice_set.get(pk=request.POST['login'])
		#selected_password = person.choice_set.get(pk=request.POST['password'])

	# What is Choice object doing in the line below?
	#except (KeyError, Choice.DoesNotExist):
	except (KeyError, Account1.DoesNotExist):
	#except (KeyError, Account1.DoesNotExist):
# Redisplay the question voting form.
		#account1 = get_object_or_404(Account1) 
		#person = get_object_or_404(Person) 
		#person = Person
		#account1 = Account1
		#return render(request, 'banking/login.html', {
	#'person': person,
	#'error_message': "You didn't select a choice.",
		#return render(request, 'banking/login.html')
		return render(request, 'banking/login.html', {
		'person': person,
		'error_message': "You didn't select a choice.",
	})

		#person = Person
		#account1 = Account1
		#context = {'account1':account1,'person':person}
		#template = loader.get_template('banking/login.html')
		#return HttpResponse(template.render(context,request)
	else:
	# Always return an HttpResponseRedirect after successfully dealing
	# with POST data. This prevents data from being posted twice if a
	# user hits the Back button.
		#person = Person
		#account1 = Account1
		#context = {'account1':account1,'person':person}
		#template = loader.get_template('banking/welcome.html')
		#return HttpResponse(template.render(context,request))
		return HttpResponseRedirect(reverse('banking:welcome'))


def transfer(request):
	person = Person
	account1 = Account1
	context = {'account1':account1,'person':person}
	template = loader.get_template('banking/transfer.html')
	return HttpResponse(template.render(context,request))

def welcome(request):
	person = Person
	account1 = Account1
	context = {'account1':account1,'person':person}
	template = loader.get_template('banking/welcome.html')
	return HttpResponse(template.render(context,request))

def withdraw(request):
	person = Person
	account1 = Account1
	context = {'account1':account1,'person':person}
	template = loader.get_template('banking/withdraw.html')
	return HttpResponse(template.render(context,request))
from django.c