Re: http://lightbird.net/dbe/ ... django by example help

167 views
Skip to first unread message

Jonathan Baker

unread,
Nov 18, 2012, 11:29:53 AM11/18/12
to django...@googlegroups.com
You need to import any modules that you want to work with. So, at the top of the file where you are calling 'models.Model' you need to add:

from django.db import models

... to the top of your script, which will bring the 'models' module into scope. In similar fashion, within the file where you are calling 'admin.ModelAdmin' you need to bring the 'admin' module in to scope by adding:

from django.contrib import admin

...to the top of your script.

Cheers,
Jonathan

On Sun, Nov 18, 2012 at 8:05 AM, boxcarlo <box....@gmail.com> wrote:
Hi,
I'm not very expert on python and django, I'm investigating now these incredible tools.
I found online http://lightbird.net/dbe/ - "Django by example", an excellent tutorial to experiment with simple apps.
I'm trying to work on the example n. 3 "Photo Organizer and Sharing App", but when I try to enter the code in the first step of the tutorial "Enhancing admin" http://lightbird.net/dbe/photo.html#enhancing-admin, my ide editor "Aptana" identifies some errors:
- Class Image (models.Model): (Error message: Undefined variable: models
- Class ImageAdmin (admin.ModelAdmin): Undefined variable: admin

I'm completely blocked. Is there anyone who can help me?

thanks

Carlo

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



--
Jonathan D. Baker
Developer
http://jonathandbaker.com

donarb

unread,
Nov 18, 2012, 4:02:20 PM11/18/12
to django...@googlegroups.com
When you look at the web page, the code in the "Enhancing Admin" section is code that should be added to the code in the first listing. So the import statements that you need are already there.
Reply all
Reply to author
Forward
0 new messages