On Fri, Oct 7, 2011 at 4:25 PM, Shawn Milochik wrote:
> On Fri, Oct 7, 2011 at 11:15 AM, Tom Evans wrote:
>>
>> I do this a lot, and haven't found any problems with doing so. My main
>> app has no models.py, but has models/{__init__,foo}.py, and it is
>> still found quite happily by syncdb, south
On Fri, Oct 7, 2011 at 8:31 PM, Oscar Carballal wrote:
> I was watching this thread for a while now, and I've got a question.
>
> What is the reason to split the models.py file? I mean, I'm currently
> working on a django project, and the models are pretty "simple" (I
> usually split them into app
On Fri, Oct 7, 2011 at 2:31 PM, Oscar Carballal wrote:
> Should I split it? Why?
you already have. splitted in apps, which is often the best way.
but, since most of the 'business methods' code should be in the model
(and not in the views as many PHP-refugees tend to do), sometimes a
models.py
I was watching this thread for a while now, and I've got a question.
What is the reason to split the models.py file? I mean, I'm currently
working on a django project, and the models are pretty "simple" (I
usually split them into apps) the biggest models file has five or six
models in the same fil
On Fri, Oct 7, 2011 at 1:06 PM, bcrem wrote:
> I don't think this format is
> S eccentric that a python purist who comes along later to maintain
> my code can't figure it out pretty quickly.
nobody said that. what we're saying is:
1- one-model/one-file isn't a goal by itself. nothing wron
Thanks Bill F - caught my import error when I tried the second
method. Just went back & tried the models/ approach; as long as I
import my classes to a models.py file and add 'models' to
INSTALLED_APPS in settings.py syncdb works fine. So basically I'm
creating a models 'app' without any views to
On Fri, Oct 7, 2011 at 10:57 AM, Calvin Spealman wrote:
> On Fri, Oct 7, 2011 at 10:39 AM, bcrem wrote:
>> 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 m
I think that you want:
from poll import *
in dummy/models/__init__.py
On Fri, Oct 7, 2011 at 11:30 AM, bcrem 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
> $
On Fri, Oct 7, 2011 at 10:39 AM, bcrem wrote:
> 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
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
On Fri, Oct 7, 2011 at 11:15 AM, Tom Evans wrote:
> I do this a lot, and haven't found any problems with doing so. My main
> app has no models.py, but has models/{__init__,foo}.py, and it is
> still found quite happily by syncdb, south, the admin interface, the
> app template loader etc.
>
> Is t
On Fri, Oct 7, 2011 at 3:57 PM, Shawn Milochik wrote:
> Tom,
> The 'magic' I was referring to was the check for the existence of a
> 'models.py,' thus preventing you from replacing it with a models directory
> containing __init__.py. That's what a Pythonista would normally do in this
> case. That
Tom,
The 'magic' I was referring to was the check for the existence of a
'models.py,' thus preventing you from replacing it with a models directory
containing __init__.py. That's what a Pythonista would normally do in this
case. That 'magic' requires you to import the things from models.py instead
On Fri, Oct 7, 2011 at 3:43 PM, Shawn Milochik wrote:
> Make as many files as you want, and make sure you import their classes in
> models.py so they get picked up by syncdb.
> Normally, to do something like this you'd replace the file (in this case
> models.py) with a folder named 'models' contai
On Fri, Oct 7, 2011 at 10:47 AM, Chris Czub wrote:
> Shawn -- what do you recommend instead? A friend and I recently had
> this debate. His suggestion was to split off as much behavior into
> smaller apps with only a handful of models in the models.py as
> possible, but I said that if it's not re
Shawn -- what do you recommend instead? A friend and I recently had
this debate. His suggestion was to split off as much behavior into
smaller apps with only a handful of models in the models.py as
possible, but I said that if it's not reusable, it shouldn't be an
app. I still haven't found a solut
Make as many files as you want, and make sure you import their classes in
models.py so they get picked up by syncdb.
Normally, to do something like this you'd replace the file (in this case
models.py) with a folder named 'models' containing a file called
__init__.py, and import all the additional
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 o
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 the
19 matches
Mail list logo