Writing your first Django app, part 1 (1.6)

181 views
Skip to first unread message

Suhendri

unread,
Dec 10, 2013, 5:19:48 PM12/10/13
to django...@googlegroups.com
Hi,

I'm new in Django, I'm excited with Django so I have to following the existing tutorial to knew how to create a program with Django.

I started with tutorial 1, Writing your first Django app, part1. I used Django 1.6 and SQLite


I followed the instructions from the starting of the tutorial, until the line of # Create three choices I got an error.

When I typed p.choice_set.create(choice_text='Not much', votes=0), I got an error:
AttributeError: Traceback (most recent call last):
...
AttributeError: 'Choice' object has no attribute 'question'

I followed the tutorial exactly as it shown on web, but I got an error on that line. Did I missed something in the tutorial ?

Could you help me, to solve this problem so i can continue learn the tutorial.

Joey Chang

unread,
Dec 10, 2013, 9:46:03 PM12/10/13
to django...@googlegroups.com
can you share more lines you typed before. It's hard to analysis depending on just one line


2013/12/11 Suhendri <suhendri...@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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8714d33c-ab05-4a70-b88f-b3b52707549e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Tom Evans

unread,
Dec 11, 2013, 4:46:38 AM12/11/13
to django...@googlegroups.com
On Tue, Dec 10, 2013 at 10:19 PM, Suhendri <suhendri...@gmail.com> wrote:
> Hi,
>
> I'm new in Django, I'm excited with Django so I have to following the
> existing tutorial to knew how to create a program with Django.
>
> I started with tutorial 1, Writing your first Django app, part1. I used
> Django 1.6 and SQLite
>
>
> I followed the instructions from the starting of the tutorial, until the
> line of # Create three choices I got an error.
>
> When I typed p.choice_set.create(choice_text='Not much', votes=0), I got an
> error:
> AttributeError: Traceback (most recent call last):
> ...
> AttributeError: 'Choice' object has no attribute 'question'

When you encounter an error and ask for help, it is useful for those
helping you to see the error message. Here, you have purposefully
removed most of the error message.

>
> I followed the tutorial exactly as it shown on web, but I got an error on
> that line. Did I missed something in the tutorial ?

Probably - the tutorial does work if you follow all the steps
precisely. Retry that part of the tutorial, and if you do have
problems, reply back showing the full error message and what you typed
to get it.

Cheers

Tom

Alasdair Nicol

unread,
Dec 11, 2013, 5:08:43 AM12/11/13
to django...@googlegroups.com
Hi,

The Django tutorial has changed between 1.6 and the current development
version. Because your error references the Choices.question field, it
sounds as if you may have been following the development version in places.

Make sure that you follow the Django 1.6 tutorial throughout. If you
retry and follow the instructions, it should work.

You can select the version of the tutorial using the selector in the
bottom-right corner of the screen.

Cheers,
Alasdair

On 10/12/13 22:19, Suhendri wrote:
> Hi,
>
> I'm new in Django, I'm excited with Django so I have to following the
> existing tutorial to knew how to create a program with Django.
>
> I started with tutorial 1, Writing your first Django app, part1. I used
> Django 1.6 and SQLite
>
>
> I followed the instructions from the starting of the tutorial, until the
> line of *# Create three choices* I got an error.
>
> When I typed p.choice_set.create(choice_text='Not much', votes=0), I got
> an error:
> *AttributeError: Traceback (most recent call last):*
> *...*
> *AttributeError: 'Choice' object has no attribute 'question'*
>
> I followed the tutorial exactly as it shown on web, but I got an error
> on that line. Did I missed something in the tutorial ?
>
> Could you help me, to solve this problem so i can continue learn the
> tutorial.
>

--
Alasdair Nicol
Developer, MEMSET

mail: alas...@memset.com
web: http://www.memset.com/

Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK

Suhendri

unread,
Dec 11, 2013, 8:00:20 AM12/11/13
to django...@googlegroups.com
Dear all,

The problem is solved..

The root cause were in models.py. I missed type a variable for return value on Choice Class.

Anyway, big thanks for all your supports
Reply all
Reply to author
Forward
0 new messages