Hello,
I am experienced PHP developer (and by PHP I mean advanced programming
with MVC frameworks, TDD, ORM libraries, design patterns and such, so
no scoffing please :)) and I would like to try something new. I've
chosen Python and Django and I am building my bachelor thesis project
with it.

I dived directly into django-nonrel fork, because I am building the
project on App Engine. However, I have few basic questions that
concern basic relational Django as well.

1) Since Python has no object encapsulation, I have no idea how to
implement computed columns in its models. E. g. I want to save forum
post rating in the "posts" table even if I have related table with all
the related post votes because it's faster and no joins are required
to get the rating value.

2) I would like to perform some integrity checking before saving
object to the database. I found here (http://docs.djangoproject.com/en/
1.2/topics/db/models/#overriding-predefined-model-methods) that I can
override entity save method and stop it's execution before calling
parent implementation. However, this didn't work for me for two
reasons - it somehow caused 500 error on App Engine (because the app
does not know that the object was not saved?) and it does not meet my
needs - I would like to "attach" some error message to this
application state and I would like this message to bubble up to the
form errors (in case it happens when a form is submitted) in a way
compatible with Django admin, so the user can fix the problem.

3) I would like to read about some best practices about midsize and
large Django projects. How to organize the code, what directory
structure to choose etc. Are there any additional layers between model
and views widely used? Where should I put my code that is not directly
related to model and is used in more than one view? Can you recommend
me some articles about this topic?

4) What about dependency injection? From what I saw so far it seems
like Django is full of singletons, static attributes and methods and
hidden dependencies, which are considered as bad practice. For example
how can I use two connections to two different databases to load and
save model entities? Are there any "inversion of control" concepts?

Thank you very much! And you can expect more questions to come in this
thread :)

Ondřej Mirtes from Prague, Czech Republic

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