Re: Attribute error

2021-05-18 Thread Peter Kirieny
tanks for this, it was helpfull


On Thu, 13 May 2021 at 15:31, Ryan Nowakowski  wrote:

> It's likely that your instance of OrderItem has a product field that's
> null.
>
> On May 12, 2021 3:50:42 AM CDT, Peter Kirieny 
> wrote:
> >can somebody help with this please, am building an ecommerce web and
> >when i
> >want to view my cart i get this error
> >AttributeError: 'NoneType' object has no attribute 'price'
> >
> >here is my models.py
> >class OrderItem(models.Model):
> >
> >product = models.ForeignKey(Product, on_delete=models.SET_NULL,
> >null=True)
> > order = models.ForeignKey(Order, on_delete=models.SET_NULL, null=True)
> >quantity = models.IntegerField(default=0, null=True, blank=True)
> >date_added = models.DateTimeField(auto_now_add=True)
> >
> >@property
> >def get_total(self):
> >total = self.product.price * self.quantity
> >return total
> >
> >
> >
> >AttributeError at /cart/
> >
> >'NoneType' object has no attribute 'price'
> >
> >Request Method: GET
> >Request URL: http://127.0.0.1:8000/cart/
> >Django Version: 3.2
> >Exception Type: AttributeError
> >Exception Value:
> >
> >'NoneType' object has no attribute 'price'
> >
> >Exception Location:
> >C:\Users\Admin\PycharmProject\MyProject\Ecommerce\shop\models.py, line
> >71,
> >in get_total
> >Python Executable:
> >C:\Users\Admin\PycharmProject\MyProject\venv\Scripts\python.exe
> >Python Version: 3.8.2
> >Python Path:
> >
> >['C:\\Users\\Admin\\PycharmProject\\MyProject\\Ecommerce',
>
> >'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
> > 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38\\DLLs',
> > 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38\\lib',
> > 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38',
> > 'C:\\Users\\Admin\\PycharmProject\\MyProject\\venv',
> >'C:\\Users\\Admin\\PycharmProject\\MyProject\\venv\\lib\\site-packages']
> >
> >Server time: Wed, 12 May 2021 08:44:09 +
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/FDF6B1C2-9134-43D2-8057-EA3BCF14C2A1%40fattuba.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL8t8eoTHsQh2Lu6oVWdF8sZvoBgTMTrEY4KFU__eepU0QP1uw%40mail.gmail.com.


Re: Attribute error

2021-05-13 Thread Ryan Nowakowski
It's likely that your instance of OrderItem has a product field that's null. 

On May 12, 2021 3:50:42 AM CDT, Peter Kirieny  wrote:
>can somebody help with this please, am building an ecommerce web and
>when i
>want to view my cart i get this error
>AttributeError: 'NoneType' object has no attribute 'price'
>
>here is my models.py
>class OrderItem(models.Model):
>
>product = models.ForeignKey(Product, on_delete=models.SET_NULL,
>null=True)
> order = models.ForeignKey(Order, on_delete=models.SET_NULL, null=True)
>quantity = models.IntegerField(default=0, null=True, blank=True)
>date_added = models.DateTimeField(auto_now_add=True)
>
>@property
>def get_total(self):
>total = self.product.price * self.quantity
>return total
>
>
>
>AttributeError at /cart/
>
>'NoneType' object has no attribute 'price'
>
>Request Method: GET
>Request URL: http://127.0.0.1:8000/cart/
>Django Version: 3.2
>Exception Type: AttributeError
>Exception Value:
>
>'NoneType' object has no attribute 'price'
>
>Exception Location:
>C:\Users\Admin\PycharmProject\MyProject\Ecommerce\shop\models.py, line
>71,
>in get_total
>Python Executable:
>C:\Users\Admin\PycharmProject\MyProject\venv\Scripts\python.exe
>Python Version: 3.8.2
>Python Path:
>
>['C:\\Users\\Admin\\PycharmProject\\MyProject\\Ecommerce',
>'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
> 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38\\DLLs',
> 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38\\lib',
> 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python38',
> 'C:\\Users\\Admin\\PycharmProject\\MyProject\\venv',
>'C:\\Users\\Admin\\PycharmProject\\MyProject\\venv\\lib\\site-packages']
>
>Server time: Wed, 12 May 2021 08:44:09 +

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FDF6B1C2-9134-43D2-8057-EA3BCF14C2A1%40fattuba.com.


Re: Attribute Error

2020-02-17 Thread maninder singh Kumar
Have you tried putting a print statement in views.py RegisterStudent to get to 
an output in the server.
Perhaps the problem is in the template and the get isn't even coming to the view

Sent from my iPad

> On 17-Feb-2020, at 6:30 PM, Adam Mičuda  wrote:
> 
> Hi,
> you have to return instance of `django.http.HttpResponse` class from you view 
> `RegisterStudent` instead of string: line 98 and line 99.
> 
> see 
> https://docs.djangoproject.com/en/3.0/ref/request-response/#django.http.HttpResponse
> 
> Regards.
> 
> Adam
> 
> 
> po 17. 2. 2020 v 13:49 odesílatel Ernest Thuku  napsal:
>> Hello guys please help on the error. I have been stuck for days now.
>> I am Ernest from Kenya.
>> please look into these files below
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAPsfuofNxRkkcP4WtnG7cF-mbrN-GvgD4ene%3D0i_ChK6N8VVcw%40mail.gmail.com.
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAB9%3DGXYFq4HcbGM3vPj8aKYAZd3LWc6mJZ19eKuR7v1xjTHM4Q%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/597EBAE3-0491-4B0A-A59C-791804ED56D4%40gmail.com.


Re: Attribute Error

2020-02-17 Thread Ayser shuhaib
Pleas provide the code for clickjacking.py

On Mon, 17 Feb 2020 at 14:50, Ernest Thuku  wrote:

> Hello guys please help on the error. I have been stuck for days now.
> I am Ernest from Kenya.
> please look into these files below
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPsfuofNxRkkcP4WtnG7cF-mbrN-GvgD4ene%3D0i_ChK6N8VVcw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE0AZGJ-VqRLv6oD%2BEHBO6T_DqHq1YinH69k7-EaQz-m33WS7w%40mail.gmail.com.


Re: Attribute Error

2020-02-17 Thread Adam Mičuda
Hi,
you have to return instance of `django.http.HttpResponse` class from you
view `RegisterStudent` instead of string: *line 98* and *line 99*.

see
https://docs.djangoproject.com/en/3.0/ref/request-response/#django.http.HttpResponse

Regards.

Adam


po 17. 2. 2020 v 13:49 odesílatel Ernest Thuku 
napsal:

> Hello guys please help on the error. I have been stuck for days now.
> I am Ernest from Kenya.
> please look into these files below
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPsfuofNxRkkcP4WtnG7cF-mbrN-GvgD4ene%3D0i_ChK6N8VVcw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB9%3DGXYFq4HcbGM3vPj8aKYAZd3LWc6mJZ19eKuR7v1xjTHM4Q%40mail.gmail.com.


Re: attribute error

2018-08-28 Thread Andréas Kühne
HI,

You are trying to include a view that is called views from the module home
in the app jobs.

I think what you mean is :
path('', jobs.views.home, name='home')

Try that instead.

Regards,

Andréas


Den tis 28 aug. 2018 kl 13:35 skrev Imran Sharief :

> hi every one i am new to django am getting attribute error past from 2
> days i got stuck in this error only i have attached the file also plz do
> help me to resolve this error
>
> --
> 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/ccbece42-238d-411b-854d-e279b9dcb682%40googlegroups.com
> 
> .
> 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/CAK4qSCdHUeouMFu_5S3ZGLVoJ%3Df8YoWdChKUYoZWzVS%3DGa8_cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error

2018-05-30 Thread 岳贝
The date = models.DataTimeField() should be date = models.DateTimeFild() ?
https://docs.djangoproject.com/en/2.0/ref/models/fields/#datetimefield

Caleb Bryson  于2018年5月31日周四 上午9:45写道:

> I am getting a attribute error when i try to run my server. does anyone
> know what i can change in this code to fix that?
>
> from django.db import models
>
> class Post(models.Model) :
> title = models.Charfield(max_length=140)
> body = models.Textfield()
> date = models.DataTimeField()
>
> def __str__(self):
> return self.title
>
> --
> 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/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com
> 
> .
> 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/CAC5CVE1XAmFN-jgjy03Ggn%3D1rtf-1qTDVcpCtb_suJ2-k6gaDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error

2018-05-30 Thread Spence Patrick
The f in field should be capitalized

On Wed, May 30, 2018, 20:10 Caleb Bryson  wrote:

> it is still saying "AttributeError: model 'django.db.models' has no
> attribute 'Charfeild'
>
> On Wednesday, May 30, 2018 at 10:04:04 PM UTC-4, Mike Dewhirst wrote:
>>
>> On 31/05/2018 11:45 AM, Caleb Bryson wrote:
>> > I am getting a attribute error when i try to run my server. does
>> > anyone know what i can change in this code to fix that?
>>
>> Try indenting the __str__ method so it is within the scope of the Post
>> class
>>
>> >
>> > from django.db import models
>> > class Post(models.Model) :
>> > title = models.Charfield(max_length=140)
>> > body = models.Textfield()
>> > date = models.DataTimeField()
>> > def __str__(self):
>> > return self.title
>> > --
>> > 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/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com
>> > <
>> https://groups.google.com/d/msgid/django-users/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com?utm_medium=email_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 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/e2d17976-18e1-4120-950d-1457858f012b%40googlegroups.com
> 
> .
> 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/CAD6-5Chfe5X_J8KbfWs7Otz7W45T4QVfYULW4UDkYU%3D2AAaZrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error

2018-05-30 Thread Caleb Bryson
I think it was because i did not use camel casing so CharField instead of 
Charfield. I will continue the tutorial and see if that works


On Wednesday, May 30, 2018 at 10:04:04 PM UTC-4, Mike Dewhirst wrote:
>
> On 31/05/2018 11:45 AM, Caleb Bryson wrote: 
> > I am getting a attribute error when i try to run my server. does 
> > anyone know what i can change in this code to fix that? 
>
> Try indenting the __str__ method so it is within the scope of the Post 
> class 
>
> > 
> > from django.db import models 
> > class Post(models.Model) : 
> > title = models.Charfield(max_length=140) 
> > body = models.Textfield() 
> > date = models.DataTimeField() 
> > def __str__(self): 
> > return self.title 
> > -- 
> > 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/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com?utm_medium=email_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 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/931b7ebc-430d-4e6c-802f-db0f0c2a1a73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error

2018-05-30 Thread Caleb Bryson
it is still saying "AttributeError: model 'django.db.models' has no 
attribute 'Charfeild'

On Wednesday, May 30, 2018 at 10:04:04 PM UTC-4, Mike Dewhirst wrote:
>
> On 31/05/2018 11:45 AM, Caleb Bryson wrote: 
> > I am getting a attribute error when i try to run my server. does 
> > anyone know what i can change in this code to fix that? 
>
> Try indenting the __str__ method so it is within the scope of the Post 
> class 
>
> > 
> > from django.db import models 
> > class Post(models.Model) : 
> > title = models.Charfield(max_length=140) 
> > body = models.Textfield() 
> > date = models.DataTimeField() 
> > def __str__(self): 
> > return self.title 
> > -- 
> > 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/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com?utm_medium=email_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 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/e2d17976-18e1-4120-950d-1457858f012b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error

2018-05-30 Thread Mike Dewhirst

On 31/05/2018 11:45 AM, Caleb Bryson wrote:
I am getting a attribute error when i try to run my server. does 
anyone know what i can change in this code to fix that?


Try indenting the __str__ method so it is within the scope of the Post class



from django.db import models
class Post(models.Model) :
title = models.Charfield(max_length=140)
body = models.Textfield()
date = models.DataTimeField()
def __str__(self):
return self.title
--
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/b0ffbdfa-8eee-4560-9fc1-16849c8fdceb%40googlegroups.com 
.

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/16cd9f05-39ae-735b-d2eb-f9802c043a8e%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error at /admin/ by Django

2018-04-06 Thread Melvyn Sopacua
On vrijdag 6 april 2018 09:05:20 CEST Hamroz Jumaev wrote:
> http://dpaste.com/2GDFCG8
No middleware.

-- 
Melvyn Sopacua

-- 
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/56429012.RfAilTTXfn%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


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 

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 

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 

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.

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

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

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

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

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.


Re: Attribute error

2011-05-01 Thread DJ Ango
Capitalize class names.

class Wish(models.Model):
 the_wish = models.CharField(max_length=100)

On Apr 30, 4:26 pm, Pulkit Mehrotra  wrote:
> changed the name but nothing happened
> the django version is 1.3

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



Re: Attribute error

2011-04-30 Thread Pulkit Mehrotra
changed the name but nothing happened 
the django version is 1.3

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



Re: Attribute error

2011-04-30 Thread Karen Tracey
On Sat, Apr 30, 2011 at 3:45 PM, Pulkit Mehrotra
wrote:

> 'module' object has no attribute 'CharField'
>
> What does this error means ???
>
> View for this is:
> from django.shortcuts import render_to_response
> from django.http import HttpResponseRedirect,HttpResponse
> from wishlist.models import wish
> from wishlist.forms import wish
>
>
Somebody else tried to point this out on your previous question, but you
apparently didn't see that answer, or didn't understand it? As long as you
have two different things you are trying to call by the same name, you are
going to get odd errors like this. Change the name of one of your wishes to
something else: you cannot call both the model and the form "wish". And if
you've done the same sort of thing elsewhere, undo it as well. The error
message rather sounds like you've done something similar with re-binding the
name 'models' or 'forms' to your own thing rather than django.db.models and
django.forms.

Karen
-- 
http://tracey.org/kmt/

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



Re: Attribute error

2011-04-30 Thread Yongning Liang
class wish(models.Model):
wish=models.CharField(max_length=200)


what's your django version


On Sun, May 1, 2011 at 3:45 AM, Pulkit Mehrotra
wrote:

> AttributeError at /mysite/wishlist/
>
> 'module' object has no attribute 'CharField'
>
> What does this error means ???
>
> View for this is:
> from django.shortcuts import render_to_response
> from django.http import HttpResponseRedirect,HttpResponse
> from wishlist.models import wish
> from wishlist.forms import wish
>
> def wishlist(request):
>   wish_list=wish.objects.all()
>   return render_to_response(
>   'wishlist/wishlist.html',
>   {'list':wish_list}
>   )
>
> def wish_form(request):   
>   return render_to_response('wishlist/wish_form.html', {'form': form, })
>
> def search(request):
> if 'q' in request.GET:
> message = 'You searched for: %r' % request.GET['q']
> else:
> message = 'You submitted an empty form.'
> return HttpResponse(message)
>
> The models.py for this is:
> from django.db import models
>
> class wish(models.Model):
>   wish=models.CharField(max_length=200)
>   wish_date=models.DateTimeField('date published')
>
> the urls.py for this is:
> from django.conf.urls.defaults import patterns, include, url
> from mysite.wishlist import views
>
> # Uncomment the next two lines to enable the admin:
> # from django.contrib import admin
> # admin.autodiscover()
>
> urlpatterns = patterns('',
>   (r'^mysite/wishlist/$','wishlist.views.wishlist'),
>   (r'^mysite/wish/$','wishlist.views.wish_form'),
>   (r'^mysite/wishsearch/$','wishlist.views.search'),  
>   # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^mysite/', include('mysite.foo.urls')),
>
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
> # url(r'^admin/', include(admin.site.urls)),
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ATTRIBUTE ERROR

2010-11-02 Thread Tom Evans
On Tue, Nov 2, 2010 at 11:08 AM, sami nathan  wrote:
> If i am doing anything wrong forgive me i am newbe
>
>
> MY error is
> Exception Type:         AttributeError
> Exception Value:
>
> 'str' object has no attribute 'resolve'
>
> Exception Location:
>        D:\Python25\lib\site-packages\django\core\urlresolvers.py in resolve,
> line 25
>
>
> My url.py  look like this
> from django.conf.urls.defaults import *
> from it.view import current_datetime
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>    # Example:
>     (r'^wap/di/sub/$",current_datetime')

This line is wrong ^^^

Quote your strings correctly and you won't get this error.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: ATTRIBUTE ERROR

2010-10-28 Thread yu xue
Hi, I feel there are some places which need to modify:
1. urlpatterns should be  (r"^wap/di/sub/$", current_datetime),
2. It seems that the view function is endless loop...


2010/10/28 sami nathan 

> My occured Error is
>
> Exception Value:
>
> 'str' object has no attribute 'resolve'
>
> Exception Location:
>C:\Python25\Lib\site-packages\django\core\urlresolvers.py in
> resolve,
> line 217
>
> ~
> MY URLS.PY LOOKS LIKE THIS
> from django.conf.urls.defaults import *
> from flip.view import current_datetime
>
> urlpatterns = ('',
># Example:
>
>   (r"^wap/di/sub",current_datetime)
>
> )
># Uncomment the admin/doc line below to enable admin documentation:
># (r'^admin/doc/', include('django.contrib.admindocs.urls')),
># Uncomment the next line to enable the admin:
># (r'^admin/', include(admin.site.urls))
> My view .py Looks like this
> from django.http import *
> import urllib
>
> def current_datetime(request):
>word = request.GET['word']
>message = urllib.urlopen('
> http://m.broov.com/wap/di/sub?word='+word+'=00submit=Submit
> ',)
>return HttpResponse (message)
>
> Please help me i dont na what happens it was running succesfully but
> noow its not
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
 此致
敬礼!
   薛宇

   身前身后
   是时间的深渊

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: Attribute Error when doing a syncdb.

2008-10-25 Thread ஆமாச்சு

//I'm doing a little blog app and I'm going to be using tagging in it.
So I wen to the google code page and downloaded it, named it tagging
(instead of tagging-0.2.1), and then ran the install.//

Does the unzipped folder had a directory 'tagging' inside with the app
rests?

Please include that to the installed apps and check.

--
Amachu

--~--~-~--~~~---~--~~
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: Attribute Error: 'NoneType' object has no attribute 'get_field_sets'

2008-06-18 Thread Joseph

Molly,
You are on windows. So $ is not applicable to you. Go to command
prompt and type

python manage.py validate

Anyway, I have sent you a mail that points to one of Django
documentation page. See if you have the admin class defined.

If you are new to programming/python/django, I would recommend that
you complete the Django tutorial. That should give you an exposure to
all components of Django. Then make that tutorial into a standalone
script. That way, if you encounter any error, you will be able to
communicate with this forum in much better way.

It might be frustrating to learn all the components. But you will
succeed in the end.

Good luck,
Joseph
http://www.jjude.com
--~--~-~--~~~---~--~~
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: Attribute Error: 'NoneType' object has no attribute 'get_field_sets'

2008-06-18 Thread Molly

My bad, I mean I have to import all of the errors it gives me when I
got to run the site..

What do you mean "Have you tried $ python manage.py validate?"

I put that into the cmd if that's what you mean, and it gave me an
error for the $ sign, it said

"'$' is not recognized as an internal or external command,
operable program or batch file."

so I got rid of the $ sign and tried it that way and it launched up
the cmd quick and things ran through it, and closed.

I then tried it, and still same error.

Sorry if I don't understand!

Thanks for the help, aprreciate it :)

Molly

On Jun 18, 12:17 pm, "Florencio Cano" <[EMAIL PROTECTED]>
wrote:
> What do you mean with "importing your models"? Do you mean syncing
> them with the database? Have you tried $ python manage.py validate?
>
> 2008/6/18 Molly <[EMAIL PROTECTED]>:
>
>
>
> > I am creating an app to be run on the desktop,
>
> > I am in the process of importing my models, and I got this error:
>
> > 
>
> > AttributeError at /admin/base/incident/add/
> > 'NoneType' object has no attribute 'get_field_sets'
>
> > Request Method: GET
> > Request URL:http://127.0.0.1:8000/admin/base/incident/add/
> > Exception Type: AttributeError
> > Exception Value: 'NoneType' object has no attribute 'get_field_sets'
> > Exception Location: C:\Python25\lib\site-packages\django\contrib\admin
> > \views\main.py in render_change_form, line 203
> > Python Executable: C:\Python25\pythonw.exe
> > Python Version: 2.5.2
> > Python Path: ['C:\\dev\\incidents2\\hazard_inventory', 'C:\\Python25\
> > \Lib\\idlelib', 'C:\\Python25\\python25.zip', 'C:\\Python25\\DLLs', 'C:
> > \\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\
> > \lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'c:\
> > \dev']
> > Server time: Wed, 18 Jun 2008 11:48:51 -0400
>
> > 
>
> > I am new to programming so i'm not sure what this is.
> > I would really appreciate any help!
>
> > Thanks!!
> > Molly
--~--~-~--~~~---~--~~
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: Attribute Error: 'NoneType' object has no attribute 'get_field_sets'

2008-06-18 Thread Florencio Cano

What do you mean with "importing your models"? Do you mean syncing
them with the database? Have you tried $ python manage.py validate?

2008/6/18 Molly <[EMAIL PROTECTED]>:
>
> I am creating an app to be run on the desktop,
>
> I am in the process of importing my models, and I got this error:
>
> 
>
> AttributeError at /admin/base/incident/add/
> 'NoneType' object has no attribute 'get_field_sets'
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/admin/base/incident/add/
> Exception Type: AttributeError
> Exception Value: 'NoneType' object has no attribute 'get_field_sets'
> Exception Location: C:\Python25\lib\site-packages\django\contrib\admin
> \views\main.py in render_change_form, line 203
> Python Executable: C:\Python25\pythonw.exe
> Python Version: 2.5.2
> Python Path: ['C:\\dev\\incidents2\\hazard_inventory', 'C:\\Python25\
> \Lib\\idlelib', 'C:\\Python25\\python25.zip', 'C:\\Python25\\DLLs', 'C:
> \\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\
> \lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'c:\
> \dev']
> Server time: Wed, 18 Jun 2008 11:48:51 -0400
>
> 
>
> I am new to programming so i'm not sure what this is.
> I would really appreciate any help!
>
> Thanks!!
> Molly
> >
>

--~--~-~--~~~---~--~~
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: Attribute Error on Dumpdata

2007-12-07 Thread Empty

Added ticket http://code.djangoproject.com/ticket/6155 with patch.
Still need to write tests.

Michael

On Dec 7, 2007 3:15 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:
>
> On Dec 7, 2007 2:31 PM, Empty <[EMAIL PROTECTED]> wrote:
>
>
> >
> >
> > > Seems dumpdata is coded to require a Manager named 'objects' for the
> Models
> > > it dumps, even though (as described here:
> > > http://www.djangoproject.com/documentation/model-api/#manager-names),
> Django
> > > does not require that a Manager named objects exists for all Models.
> > > Whether this is just an oversight in dumpdata or a conscious decision I
> > > can't say, though it looks like an oversight to me.
> >
> > You're correct Karen.  This bit of code is the culprit:
> >
> >objects = []
> >for app in app_list:
> >for model in get_models(app):
> >
> >objects.extend(model.objects.all())
> >
> > How would you propose that it be done differently?  I know that
> > through object._meta.admin.manager will give you the first manager
> > like the Admin works off of, but that is only populated if the Admin
> > inner class is defined.  I looked for the logic that does that but I
> > couldn't find it.
> >
>
> I believe it should be using _default_manager, which looks to be set to
> track the first Manager defined for a Model.  I think a (legitimate) Model
> will always have _default_manager, while it may not always have objects.
>
> 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: Attribute Error on Dumpdata

2007-12-07 Thread Karen Tracey
On Dec 7, 2007 2:31 PM, Empty <[EMAIL PROTECTED]> wrote:

>
> > Seems dumpdata is coded to require a Manager named 'objects' for the
> Models
> > it dumps, even though (as described here:
> > http://www.djangoproject.com/documentation/model-api/#manager-names),
> Django
> > does not require that a Manager named objects exists for all Models.
> > Whether this is just an oversight in dumpdata or a conscious decision I
> > can't say, though it looks like an oversight to me.
>
> You're correct Karen.  This bit of code is the culprit:
>
>objects = []
>for app in app_list:
>for model in get_models(app):
>objects.extend(model.objects.all())
>
> How would you propose that it be done differently?  I know that
> through object._meta.admin.manager will give you the first manager
> like the Admin works off of, but that is only populated if the Admin
> inner class is defined.  I looked for the logic that does that but I
> couldn't find it.
>

I believe it should be using _default_manager, which looks to be set to
track the first Manager defined for a Model.  I think a (legitimate) Model
will always have _default_manager, while it may not always have objects.

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: Attribute Error on Dumpdata

2007-12-07 Thread Empty

> Seems dumpdata is coded to require a Manager named 'objects' for the Models
> it dumps, even though (as described here:
> http://www.djangoproject.com/documentation/model-api/#manager-names), Django
> does not require that a Manager named objects exists for all Models.
> Whether this is just an oversight in dumpdata or a conscious decision I
> can't say, though it looks like an oversight to me.

You're correct Karen.  This bit of code is the culprit:

objects = []
for app in app_list:
for model in get_models(app):
objects.extend(model.objects.all())

How would you propose that it be done differently?  I know that
through object._meta.admin.manager will give you the first manager
like the Admin works off of, but that is only populated if the Admin
inner class is defined.  I looked for the logic that does that but I
couldn't find it.

Michael Trier
blog.michaeltrier.com

--~--~-~--~~~---~--~~
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: Attribute Error on Dumpdata

2007-12-07 Thread Karen Tracey
On Dec 6, 2007 8:01 PM, ttk <[EMAIL PROTECTED]> wrote:

>
> I think I found my problem...
>
> I failed to add "objects = models.Manager()" into my models which
> would explain why that attribute isn't found.
>
> I'll try this out but if anyone has additional suggestions, I'm all
> ears.


Seems dumpdata is coded to require a Manager named 'objects' for the Models
it dumps, even though (as described here:
http://www.djangoproject.com/documentation/model-api/#manager-names), Django
does not require that a Manager named objects exists for all Models.
Whether this is just an oversight in dumpdata or a conscious decision I
can't say, though it looks like an oversight to me.

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: Attribute Error on Dumpdata

2007-12-06 Thread ttk

I think I found my problem...

I failed to add "objects = models.Manager()" into my models which
would explain why that attribute isn't found.

I'll try this out but if anyone has additional suggestions, I'm all
ears.

cheers,
-ttk
--~--~-~--~~~---~--~~
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: Attribute Error

2007-08-20 Thread MikeHowarth

Guys

I spent quite a while yesterday reading through the newforms section
of the docs, and thought I'd taken everything in.

As a python novice, I wrote a test script and couldn't replicate the
error, so was beginning to wonder whether I was cracking up! After
reading Malcolm's (comprehensive) response, it does make alot more
sense and I feel to have a better understanding of how the newforms
library hinges together.

I've got to say as someone new to django I'm really impressed at the
level of support you guys have got going on.

On Aug 20, 6:54 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-08-19 at 14:30 -0700, MikeHowarth wrote:
> > I'll take a look at that.
>
> > Even commenting that line out and attempting to access self.title I'm
> > still getting an attribute error thrown: 'Register' object has no
> > attribute 'title'
>
> Doug Ballanc has explained how you should be writing your save() method.
> I thought I might just add something about why what you're doing doesn't
> seem to work, despite looking like perfectly valid Python code.
>
> The newforms Form class has a specialised __new__ method, which is what
> is responsible for attaching attributes to the object you get back from
> calling Form(). In the default case (i.e. pretty much always), what this
> method does is *not* creating attributes for anything that is a
> newforms.fields.Field subclass. Rather, those fields are put into an
> attribute called "base_fields" (which is copied to an attribute called
> "fields" in __init__).
>
> All this metaclass stuff happens in DeclarativeFieldsMetaclass in
> newforms.forms. Replacing the metaclass with something elase to populate
> the base_fields leaves open some interesting possibilities about how to
> initialise form classes for those with imagination.
>
> This might look very strange and, in a way, it is unusual. When I was
> wondering, early on in newforms life, why this was done (I think my
> initial mental question was "what was he smoking?"), I realised there
> isn't a completely natural thing to store in those attributes. Do they
> hold the normalized, cleaned data? The original value? Both, depending
> upon whether clean has been called? If the attribute is None, does that
> mean we don't have that value? We haven't set it yet? Or that the form's
> normalized value is None (possible for some fields)? How would you know
> which fields had errors in them and what would prevent you accidentally
> accessing those attributes and treating the values as real values?
>
> To some extent, it reduces confusion by not having attributes at all for
> fields. Instead, you initialise a form with the raw, submitted data.
> Then you access "cleaned_data" or is_valid() or "errors" whenever you
> like and the raw data is cleaned and normalized (where possible) and
> sent to two dictionaries: Form.cleaned_data and Form.errors.
>
> So, whilst what you were attempting might seem logical on one level,
> hopefully I've explained why it could, in many cases, be more confusing
> and error-prone than convenient. So the design uses a slightly different
> approach from providing access to the form data and errors.
>
> Best wishes,
> Malcolm
>
> --
> Borrow from a pessimist - they don't expect it 
> back.http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Attribute Error

2007-08-19 Thread Malcolm Tredinnick

On Sun, 2007-08-19 at 14:30 -0700, MikeHowarth wrote:
> I'll take a look at that.
> 
> Even commenting that line out and attempting to access self.title I'm
> still getting an attribute error thrown: 'Register' object has no
> attribute 'title'

Doug Ballanc has explained how you should be writing your save() method.
I thought I might just add something about why what you're doing doesn't
seem to work, despite looking like perfectly valid Python code.

The newforms Form class has a specialised __new__ method, which is what
is responsible for attaching attributes to the object you get back from
calling Form(). In the default case (i.e. pretty much always), what this
method does is *not* creating attributes for anything that is a
newforms.fields.Field subclass. Rather, those fields are put into an
attribute called "base_fields" (which is copied to an attribute called
"fields" in __init__).

All this metaclass stuff happens in DeclarativeFieldsMetaclass in
newforms.forms. Replacing the metaclass with something elase to populate
the base_fields leaves open some interesting possibilities about how to
initialise form classes for those with imagination.

This might look very strange and, in a way, it is unusual. When I was
wondering, early on in newforms life, why this was done (I think my
initial mental question was "what was he smoking?"), I realised there
isn't a completely natural thing to store in those attributes. Do they
hold the normalized, cleaned data? The original value? Both, depending
upon whether clean has been called? If the attribute is None, does that
mean we don't have that value? We haven't set it yet? Or that the form's
normalized value is None (possible for some fields)? How would you know
which fields had errors in them and what would prevent you accidentally
accessing those attributes and treating the values as real values?

To some extent, it reduces confusion by not having attributes at all for
fields. Instead, you initialise a form with the raw, submitted data.
Then you access "cleaned_data" or is_valid() or "errors" whenever you
like and the raw data is cleaned and normalized (where possible) and
sent to two dictionaries: Form.cleaned_data and Form.errors.

So, whilst what you were attempting might seem logical on one level,
hopefully I've explained why it could, in many cases, be more confusing
and error-prone than convenient. So the design uses a slightly different
approach from providing access to the form data and errors.

Best wishes,
Malcolm

-- 
Borrow from a pessimist - they don't expect it back. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Attribute Error

2007-08-19 Thread Doug B

I think you've got some misconceptions about newforms.
http://www.djangoproject.com/documentation/newforms/ should give you
the info you need.

Something more like this:

def save(self):
  #set up the objects we are going to populate
   user = User() # you want a new -instance- not another reference to
the User class
   user.title = self.clean_data['title']  # validated data in the
self.clean(ed)_data dict
   return user


--~--~-~--~~~---~--~~
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: Attribute Error

2007-08-19 Thread MikeHowarth

I'll take a look at that.

Even commenting that line out and attempting to access self.title I'm
still getting an attribute error thrown: 'Register' object has no
attribute 'title'

On Aug 19, 10:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> As a first guess I'm not sure that user = User is doing what you would
> want.  I think instead you want to instantiate a new User object.  All
> you are doing right now is creating an alias user for User.
>
> On Aug 19, 3:16 pm, MikeHowarth <[EMAIL PROTECTED]> wrote:
>
> > Hi I was wondering whether anyone can help me out.
>
> > I'm currently creating a form to register users, what I'm finding is
> > that when I then attempt to save the user within the Register:save
> > method I'm getting an attribute error when trying to access the title
> > attribute. I've tried referencing both title, and self.title to no
> > avail.
>
> > Can anyone advise me on where I'm going wrong with this?
>
> > class Register(forms.Form):
>
> > def __init__(self, data=None, request=None, *args, **kwargs):
> > if request is None:
> > raise TypeError("Keyword argument 'request' must be 
> > supplied")
> > super(Register, self).__init__(data, *args, **kwargs)
> > self.request = request
>
> > #personal information
> > title = forms.ChoiceField(choices=titlechoice)
>
> > def save(self):
>
> > #set up the objects we are going to populate
> > user = User
> > user.title = self.title


--~--~-~--~~~---~--~~
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: Attribute Error

2007-08-19 Thread [EMAIL PROTECTED]

As a first guess I'm not sure that user = User is doing what you would
want.  I think instead you want to instantiate a new User object.  All
you are doing right now is creating an alias user for User.

On Aug 19, 3:16 pm, MikeHowarth <[EMAIL PROTECTED]> wrote:
> Hi I was wondering whether anyone can help me out.
>
> I'm currently creating a form to register users, what I'm finding is
> that when I then attempt to save the user within the Register:save
> method I'm getting an attribute error when trying to access the title
> attribute. I've tried referencing both title, and self.title to no
> avail.
>
> Can anyone advise me on where I'm going wrong with this?
>
> class Register(forms.Form):
>
> def __init__(self, data=None, request=None, *args, **kwargs):
> if request is None:
> raise TypeError("Keyword argument 'request' must be 
> supplied")
> super(Register, self).__init__(data, *args, **kwargs)
> self.request = request
>
> #personal information
> title = forms.ChoiceField(choices=titlechoice)
>
> def save(self):
>
> #set up the objects we are going to populate
> user = User
> user.title = self.title


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