On Feb 18, 2010, at 9:41 PM, Sander wrote:

Thanks!

Those guidelines are certeinly helpfull.

Hope these helps. If you need more specific answers please expand the
following paragraph:

My main project should have a couple of entities, like for example an 'Employee', 'Manager', 'Question'. An employee can ask questions, and
a manager can read questions.

let's say the following (pure hypothetical):
- an Manager can read questions at example.com/manager/read
- an Employee can post questions at example.com/employee/add

Let me try myself:
In this case, following your guidelines,  I think I have to create an
app called 'question' whith the functionality of adding and listing
the questions
Also the Employee and Manager should be different apps because they
have functionality of changing their information.
The apps DO depent on eachoter because a question is placed by a
'Employee' but thats fine

As the others have hinted there's a large element of personal preference here: I would tend to put all these things in one app. As Atamert said, if a particular model is useless by itself, it doesn't need its own app. For instance, in your future site, does an Employee do anything except pose questions? Does a Manager do anything but answer them? Both Employees and Managers are a kind of Person – are they differentiated only by the way they interact with each other? Then they should probably be part of the same app. Likewise, if the Question model is useless without some sort of Employee/Manager model to interact with it, it doesn't need to be on its own.

I don't think it will hurt you to err on the side of consolidation…

two cents,
Eric


Am I on the right track?

Thanks


On 18 feb, 14:03, Atamert Ölçgen <mu...@muhuk.com> wrote:
On Thursday 18 February 2010 14:43:07 Sander wrote:

Hello everybody,

I'm having a little hard time starting a Django project because I'm
not sure where to place my models in the first place.

For example, the Django beginner tutorials put all entities of the
'Poll' application (Question, Answer) in a new app called Polls. Thats
pretty clear, but a poll is a pretty independant app.

My main project should have a couple of entities, like for example an 'Employee', 'Manager', 'Question'. An employee can ask questions, and
a manager can read questions.

Is it conventional to create, lets say a 'main' or 'core' app where I put these models? Or should I create different apps per functionality,
or per entity?

I hope you understand my question. Any response is much appriciated.

Thanks in advance!

Sander

I don't know the exact answers. But here is some guidelines:

* An app can depend on another app. But cyclical dependencies should be
avoided. (Even though Django allows you to reference models this way)
* Don't think in terms of entities, think in terms of **functionality**. * (Perhaps not applicable to this situation, but) learn register pattern of
admin and generic relations.
* If any two models are meaningless seperated, they should be in the same app. * An app shouldn't be too big. Not in terms of bytes, but in functionality it provides. Sometimes it's a good idea to write another app that supports the
1st one.

Hope these helps. If you need more specific answers please expand the
following paragraph:

My main project should have a couple of entities, like for example an 'Employee', 'Manager', 'Question'. An employee can ask questions, and
a manager can read questions.

--
Saygılarımla,
Atamert Ölçgen

 -+-
 --+
 +++

www.muhuk.com
mu...@jabber.org

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-us...@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-us...@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