Re: Splitting models.py into a package

2007-11-07 Thread Darryl Ross
Hi Daniel,

> class Foo(models.Model)
> some_field = models.CharField(max_length=200)
> class Meta:
> app_label = 'app'

Thanks for that, as soon as I added the app_label to the Meta class it
started working.

Regards
-D



signature.asc
Description: OpenPGP digital signature


Re: Splitting models.py into a package

2007-11-07 Thread [EMAIL PROTECTED]


On Nov 7, 8:41 pm, Darryl Ross <[EMAIL PROTECTED]> wrote:
> Note: Resending as this hasn't shown up on the list after 3 hours.
>   Appologies if it does decide to make an appearance.
>
> Hey All,
>
> I have an app that has quite a few models in it, so I am trying to split
> it out into a package, but when I do the models do not show up in the
> admin interface and running 'manage.py sqlall app' does not show any SQL
> statements for creating the tables.
>
> Is there a trick to doing this?
>
> The steps that I took are:
>  $ mkdir app/models
>  $ touch app/models/__init__.py
>  $ mv app/models.py app/models/isp.py
>
> From my views I can do 'from project.app.models.isp import ISP' and it
> all works, but it would seem that any of the django tools can't see
> them. I'm not so much worried about the admin app, but manage.py not
> being able to create the tables or permission is a problem.
>
> According to James Bennett on his blog athttp://tinyurl.com/3d39p4this
> should work?
>
> I'm running SVN r6566.
>
> Any ideas?
>
> Regards
> -D
>
>  signature.asc
> 1KDownload

I ran into this problem a while ago while doing a hobby project. At
the time I solved it by adding something like the following (using
your example names) to models/__init__.py:

from app.models.isp import *

and then in isp.py:

class Foo(models.Model)
some_field = models.CharField(max_length=200)
class Meta:
app_label = 'app'

This was a while ago, so there may be a better way to do it now, but I
just fired up that app with django r6602 and manage.py sql app spat
out sql that looked OK.

~daniel


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Splitting models.py into a package

2007-11-07 Thread Darryl Ross
Note: Resending as this hasn't shown up on the list after 3 hours.
  Appologies if it does decide to make an appearance.


Hey All,

I have an app that has quite a few models in it, so I am trying to split
it out into a package, but when I do the models do not show up in the
admin interface and running 'manage.py sqlall app' does not show any SQL
statements for creating the tables.

Is there a trick to doing this?

The steps that I took are:
 $ mkdir app/models
 $ touch app/models/__init__.py
 $ mv app/models.py app/models/isp.py

From my views I can do 'from project.app.models.isp import ISP' and it
all works, but it would seem that any of the django tools can't see
them. I'm not so much worried about the admin app, but manage.py not
being able to create the tables or permission is a problem.

According to James Bennett on his blog at http://tinyurl.com/3d39p4 this
should work?

I'm running SVN r6566.

Any ideas?

Regards
-D





signature.asc
Description: OpenPGP digital signature


Splitting models.py into a package

2007-11-07 Thread Darryl Ross
Hey All,

I have an app that has quite a few models in it, so I am trying to split
it out into a package, but when I do the models do not show up in the
admin interface and running 'manage.py sqlall app' does not show any SQL
statements for creating the tables.

Is there a trick to doing this?

The steps that I took are:
 $ mkdir app/models
 $ touch app/models/__init__.py
 $ mv app/models.py app/models/isp.py

From my views I can do 'from project.app.models.isp import ISP' and it
all works, but it would seem that any of the django tools can't see
them. I'm not so much worried about the admin app, but manage.py not
being able to create the tables or permission is a problem.

According to James Bennett on his blog at http://tinyurl.com/3d39p4 this
should work?

I'm running SVN r6566.

Any ideas?

Regards
-D



signature.asc
Description: OpenPGP digital signature