I think that you want:

  from poll import *

in dummy/models/__init__.py

On Fri, Oct 7, 2011 at 11:30 AM, bcrem <billc...@gmail.com> wrote:
> The separate models/ directory bit didn't work for me; maybe I'm not
> understanding what you mean exactly?  Here's what I did...
>
> $ django-admin.py startproject dummy
> $ cd dummy/
> $ mkdir models
> $ vi settings.py
>  ...filled in my db info...
> $ cd models
> $ vi poll.py
> $ cat models/poll.py
> from django.db import models
>
> class Poll(models.Model):
>   question = models.Charfield(max_length=200)
>   date = models.DateTimeField('date published')
> $ vi __init__.py
> $ cat __init__.py
> import poll
> $ cd ..
> $ python manage.py syncdb
>  ...created the usual django_* & auth_* tables - but no 'poll' table
>
>
> However, importing my classes into an otherwise empty models.py worked
> fine - syncdb generated the tables I was looking for, no problem.
> Thanks for the quick response everyone.
>
>
>
>
> On Oct 7, 10:41 am, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> Hi,
>>
>> Create a models directory and have an __init__.py file within.
>> Put the models you want to import in that file and you are good to go.
>>
>> Regards,
>> Xavier.
>>
>> Le 7 oct. 2011 à 16:39, bcrem a écrit :
>>
>> > Howdy,
>>
>> > I come from a C/C++ background, getting into some django/python now.
>> > I'm used to a one-class/one-file paradigm, and don't much like
>> > sticking all the models for an app in models.py.  It's a minor thing,
>> > I know...
>>
>> > Is there any way to seperate out these classes, and still have syncdb
>> > pick them up & update your database for you?
>>
>> > Thanks,
>> > bc
>>
>> > --
>> > 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 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> 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.
>
>

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

Reply via email to