Re: in the shell, "module object has no attribute Model"

2011-08-02 Thread webcomm
On Aug 2, 3:38 pm, Daniel Roseman  wrote:
> by declaring that metadata explicitly:
>
>    1. In [2]: class MyTest(models.Model):
>    2.    ...:     title=models.CharField(max_length=200)
>    3.    ...:     class Meta:
>       ...:         app_label = 'my_test'
>

Actually, that seems to have fixed both errors : )

Thx,
Ryan

-- 
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: in the shell, "module object has no attribute Model"

2011-08-02 Thread Daniel Roseman
On Tuesday, 2 August 2011 20:14:09 UTC+1, webcomm wrote:
>
> I'm also getting "list index out of range" quite often.  Here is a 
> shell session showing the error in context:  http://pastebin.com/FBE30SDK


I don't know about the 'has no attribute Model', since you don't show the 
traceback for that. I suspect you just haven't imported what you think you 
have.
 

But the 'out of range' error is because Django's expecting model class 
declarations to be inside an app's models.py. It gets certain metadata from 
there automatically. You can fix this by declaring that metadata explicitly:


   1. In [2]: class MyTest(models.Model):
   2....: title=models.CharField(max_length=200)
   3....: class Meta:
  ...: app_label = 'my_test'
   
   --
   DR.
   

-- 
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/-/KtRU4drFk_cJ.
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: in the shell, "module object has no attribute Model"

2011-08-02 Thread webcomm
I'm also getting "list index out of range" quite often.  Here is a
shell session showing the error in context:  http://pastebin.com/FBE30SDK

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