Thanks Ilya,

I will go through that this evening - I tend to learn through hardship, 
banging my head off the wall, walking away and finding a moment of clarity, 
I'm quick to understand the logic and approach but I leant the language / 
syntax through repetition. 

On Wednesday, June 11, 2014 9:44:18 PM UTC+1, Ilya Kazakevich wrote:
>
> Hello, 
>
> I believe you should start with Python tutorial: 
> https://docs.python.org/2/tutorial/ 
> After you complete it, you may go to Django tutorial. 
>
> It is generally a good idea to study basic language concepts, syntax and 
> standard library before studying any framework (you've learned PHP _before_ 
> zend/phpcacke/joomla or wordpress, right?:) ) 
>
>
>
> Ilya Kazakevich, 
> JetBrains PyCharm (Best Python/Django IDE) 
> http://www.jetbrains.com/pycharm/ 
> "Develop with pleasure!" 
>
>
> >-----Original Message----- 
> >From: [email protected] <javascript:> 
> >[mailto:[email protected] <javascript:>] On Behalf Of Patrick C 
> >Sent: Thursday, June 12, 2014 12:32 AM 
> >To: [email protected] <javascript:> 
> >Cc: [email protected] <javascript:> 
> >Subject: Re: NameError at /admin/ name 'HoleImage' is not defined 
> > 
> >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 little too quick but so far I have read through a fair bit 
> and live the 
> >prose. 
> > 
> >On Wednesday, June 11, 2014 9:26:30 PM UTC+1, Ilya Kazakevich wrote: 
> > 
> >        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 Kazakevich, 
> >        JetBrains PyCharm (Best Python/Django IDE) 
> >        http://www.jetbrains.com/pycharm/ 
> ><http://www.jetbrains.com/pycharm/> 
> >        "Develop with pleasure!" 
> > 
> > 
> >        >-----Original Message----- 
> >        >From: [email protected] <javascript:> 
> >        >[mailto:[email protected] <javascript:> ] On Behalf Of 
> Patrick C 
> >        >Sent: Thursday, June 12, 2014 12:19 AM 
> >        >To: [email protected] <javascript:> 
> >        >Subject: NameError at /admin/ name 'HoleImage' is not defined 
> >        > 
> >        >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 then multiple images for 
> the 
> >gallery. 
> >        > 
> >        >I've spend the last few hours googling how I'm going wrong here 
> because I 
> >get 
> >        >the error in the subject line. 
> >        > 
> >        >My models.py is: 
> >        > 
> >        >from django.db import models 
> >        > 
> >        > 
> >        >class Hole(models.Model): 
> >        >    hole_number = models.IntegerField() 
> >        >    hole_name = models.CharField(max_length=255) 
> >        >    hole_description = models.CharField(max_length=500) 
> >        > 
> >        > 
> >        >    def __str__(self): 
> >        >    return self.hole_number 
> >        > 
> >        > 
> >        >class HoleImage(models.Model): 
> >        >    hole = models.ForeignKey(Hole, related_name='images') 
> >        >    image = models.ImageField(upload_to='hole_photos') 
> >        >    caption = models.CharField(max_length=250) 
> >        > 
> >        > 
> >        >and my admin.py is: 
> >        > 
> >        >from django.contrib import admin 
> >        >from holes.models import Hole 
> >        > 
> >        > 
> >        >class HoleImageInline(admin.TabularInline): 
> >        >    model = HoleImage 
> >        > 
> >        > 
> >        >class HoleAdmin(admin.ModelAdmin): 
> >        >    fields = ['hole_number', 'hole_name', 'hole_description'] 
> >        >    list_display = ['hole_number', 'hole_name', 
> 'hole_description'] 
> >        >    inlines = [ HoleImageInline, ] 
> >        > 
> >        > 
> >        >admin.site.register(Hole) 
> >        > 
> >        > 
> >        > 
> >        > 
> >        >Full admin panel error is: 
> >        > 
> >        > 
> >        > 
> >        >NameError at /admin/ 
> >        > 
> >        >name 'HoleImage' is not defined 
> >        >Request Method:        GET 
> >        >Request URL:        http://127.0.0.1:8000/admin/ 
> ><http://127.0.0.1:8000/admin/> 
> >        >Django Version:        1.6.5 
> >        >Exception Type:        NameError 
> >        >Exception Value:        name 'HoleImage' is not defined 
> >        >Exception Location: 
> >/Users/my_laptop/development/golfsmart/holes/admin.py 
> >        >in HoleImageInline, line 5 
> >        >Python Executable:        /usr/bin/python 
> >        >Python Version:        2.7.5 
> >        > 
> >        > 
> >        > 
> >        > 
> >        >As I say, I'm new to this and have had a good trial and error 
> stab, I'm sure 
> >it's 
> >        >something simple I am overlooking and once I have it resolved I 
> will have 
> >a 
> >        >lesson learned as I have a few other apps to setup that will use 
> this many 
> >type 
> >        >for images. 
> >        > 
> >        >Thanks in advance. 
> >        > 
> >        > 
> >        > 
> >        > 
> >        > 
> >        >-- 
> >        >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 [email protected] <javascript:> . 
> >        >To post to this group, send email to [email protected] 
> ><javascript:> . 
> >        >Visit this group at http://groups.google.com/group/django-users 
> ><http://groups.google.com/group/django-users> . 
> >        >To view this discussion on the web visit 
> >        >
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a9 
> >5a-6f9 
> ><
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f 
> >9> 
> >        >53ad105f8%40googlegroups.com 
> >        ><
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a 
> >95a-6f 
> ><
> https://groups.google.com/d/msgid/django-users/7079f896-e765-428f-a95a-6f 
> >> 
> >        >953ad105f8%40googlegroups.com?utm_medium=email&utm_source=foot 
> >er <http://40googlegroups.com?utm_medium=email&utm_source=footer> > . 
> >        >For more options, visit https://groups.google.com/d/optout 
> ><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 [email protected] <javascript:>. 
> >To post to this group, send email to [email protected] 
> <javascript:>. 
> >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/c7b136ef-2763-4b8c-929a-f3d 
> >17751cd0e%40googlegroups.com 
> ><
> https://groups.google.com/d/msgid/django-users/c7b136ef-2763-4b8c-929a-f3 
> >d17751cd0e%40googlegroups.com?utm_medium=email&utm_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 [email protected].
To post to this group, send email to [email protected].
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/62ede173-d68f-4149-8705-f3f247794bc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to