-Original Message-
> >From: django...@googlegroups.com
> >[mailto:django...@googlegroups.com ] On Behalf Of Patrick C
> >Sent: Thursday, June 12, 2014 12:52 AM
> >To: django...@googlegroups.com
> >Subject: Re: NameError at /admin/ name 'HoleImage' is not defined
-Original Message-
>From: django-users@googlegroups.com
>[mailto:django-users@googlegroups.com] On Behalf Of Patrick C
>Sent: Thursday, June 12, 2014 12:52 AM
>To: django-users@googlegroups.com
>Subject: Re: NameError at /admin/ name 'HoleImage' is not defined
>
>Should
re!"
>
>
> >-Original Message-
> >From: django...@googlegroups.com
> >[mailto:django...@googlegroups.com ] On Behalf Of Patrick C
> >Sent: Thursday, June 12, 2014 12:32 AM
> >To: django...@googlegroups.com
> >Cc: ilya.ka...@jetbrains.com
Should it be this:
from django.contrib import admin
from holes.models import HoleImage
class HoleImageInline(admin.TabularInline):
model = HoleImage
class HoleAdmin(admin.ModelAdmin):
fields = ['hole_number', 'hole_name', 'hole_description']
list_display = ['hole_number',
Behalf Of Patrick C
>Sent: Thursday, June 12, 2014 12:32 AM
>To: django-users@googlegroups.com
>Cc: ilya.kazakev...@jetbrains.com
>Subject: Re: NameError at /admin/ name 'HoleImage' is not defined
>
>Hi Ilya,
>
>Thanks for the swift reply, sorry for the noob question
Oh and in the last line, admin.site.register, use the model you want to
register in the Admin
On Jun 11, 2014 3:41 PM, "Patrick C" wrote:
> Hi Jorge,
>
> Thanks for helping out - I understand that and have just tried it but
> still get the error:
>
> NameError at
When you import HoleImage don't remove Hole :)
On Jun 11, 2014 3:41 PM, "Patrick C" wrote:
> Hi Jorge,
>
> Thanks for helping out - I understand that and have just tried it but
> still get the error:
>
> NameError at /admin/
>
> name 'Hole' is not defined
>
> Request
Hi Jorge,
Thanks for helping out - I understand that and have just tried it but still
get the error:
NameError at /admin/
name 'Hole' is not defined
Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
1.6.5Exception Type:NameErrorException Value:
name 'Hole' is not
In admin.py you have
from hotels.models import Hole
Add HoleImage to that import
On Jun 11, 2014 3:19 PM, "Patrick C" wrote:
> Hi All,
>
> New to Django / Python (coming from PHP).
>
> Trying to make a site for a golf course where there is a hole by hole
> guide,
Hi Ilya,
Thanks for the swift reply, sorry for the noob question but can you
elaborate on "but you forgot to import HoleImage" - I'm not quite
following, I'm sure I will understand it once explained.
I'm only about 4 hours into my first workings with Python / Django, perhaps
I'm jumping in a
You need to import HoleImage in admin.py
On Jun 11, 2014 3:19 PM, "Patrick C" wrote:
> Hi All,
>
> New to Django / Python (coming from PHP).
>
> Trying to make a site for a golf course where there is a hole by hole
> guide, each hole has a number, name, description
To use any symbol (including " HoleImage" class) you need to import it first.
You've imported Hole (from holes.models import Hole), but you forgot to import
HoleImage.
So, you got " name 'HoleImage' is not defined " error.
It is better to use IDE, because it helps you in such cases :)
Ilya
12 matches
Mail list logo