models can't use globals

2006-01-09 Thread Greg
When writing a method for one of my model classes, I find that I want to access a function from another module. The reference documentation (http://www.djangoproject.com/documentation/model_api/#model-methods) is plenty clear on the fact that you can't just import a module at the top of the

Re: Django and Multiple Database Support

2006-01-09 Thread Greg
I'm faced with the multiple-schema problem in MySQL, which AFAICT is a lot simpler than actually having multiple databases because at least you don't have to coordinate multiple connections. Actually, it basically already works. I wrote class Poll(meta.Model): class META: db_table =

Re: getting csv output (easily)?

2006-01-09 Thread tonemcd
Thanks for the reminder Eric, I found that link a while ago, looked at it again yesterday and came up with this derivation of Adrians' code that works using a query inline; import csv def output(request): response = HttpResponse(mimetype='text/csv') response['Content-Disposition'] =

best practices for translating content

2006-01-09 Thread Kenneth Gonsalves
hi what are the best practices for translating content in the database, and storing that? I feel that for postgres, a separate schema for each language may be good - that way, just something like django-admin.py install new language would just duplicate the necessary tables in a separate

Re: Django DB Design Question (help please!)

2006-01-09 Thread Dody Suria Wijaya
In my experience, some designers used primary key to enforce logical parent/child relationship (where the parent's pk is prefixed into one of the child's primay key), and usually to signify the pk fields to be "uneditable" since it actually also doubles as "foreignkey", the value refer to

Re: about xgettext

2006-01-09 Thread hugo
>Thanks. But I installed python 2.4.2, there are pygettext.py and >msgfmt.py in tools folder. So I think they are standard tools in >offical python release. Django still supports Python 2.3, so scripts need to be able to run with Python 2.3. bye, Georg

Re: Django DB Design Question (help please!)

2006-01-09 Thread Kenneth Gonsalves
On Tuesday 10 Jan 2006 9:51 am, Mike wrote: > hemm. So, database by definition is heavy/inefficient in regard > to scalability? If so, please instruct me with some pointers > where I can better approach my current project as I am still in > planning phase. sorry, i had a bad morning with someone

Django and MS SQL

2006-01-09 Thread Rich Bakos
I am experimenting with Django and MS SQL and it appears that Django is passing parameters to MS SQL in an incorrect format. The params are being passed in as a format string style (%s), which MS SQL chokes on. Is anyone here using MS SQL that might be able to shed some light on this problem?

Re: Django DB Design Question (help please!)

2006-01-09 Thread Kenneth Gonsalves
On Tuesday 10 Jan 2006 9:12 am, Mike wrote: > Thank you for your elaborate and informative response. I guess I > fail to properly understand the significance of Primary Keys. > Isn't it there just to make our records Unique? Then, who cares > if the other XXX_id's are unique or not! I'd rather

Re: Django DB Design Question (help please!)

2006-01-09 Thread Mike
> I wouldn't recommend approach #2, because it's a slightly messy > database layout, but it would still work with Django as long as the > "user" field of NewsPosting was a ForeignKey(User). Thanks for your response, Mike

Re: Django DB Design Question (help please!)

2006-01-09 Thread Adrian Holovaty
On 1/9/06, Mike <[EMAIL PROTECTED]> wrote: > Actually, this was the 'aha' answer to my question. Thank you. On a > different note, is there anyway to implement approach #2, having > NewsPosting have a user_id field in django-way? If not so, is there any > reason why not? I wouldn't recommend

Re: Django DB Design Question (help please!)

2006-01-09 Thread Mike
Adrian, Actually, this was the 'aha' answer to my question. Thank you. On a different note, is there anyway to implement approach #2, having NewsPosting have a user_id field in django-way? If not so, is there any reason why not? Regards, Mike

Re: Django DB Design Question (help please!)

2006-01-09 Thread Dody Suria Wijaya
Having said that, I just remembered there's a common practice in designing database that I could never done in any ORM (not only django's), and that is to have a group of fields as primary key. Ie: Company table - company id (pk) - name Employee - company id (pk) -

Re: Django DB Design Question (help please!)

2006-01-09 Thread Dody Suria Wijaya
My approach is, if you would often be needing to get list of news both by company and user, for performance reason I would put both foreignkey (one 2 many) to company and user in newsposting model. That way, the resulting join query only need to join maximum of two tables and be faster.

Re: Session disposal

2006-01-09 Thread Jarek Zgoda
Adrian Holovaty napisał(a): >>Thanks Adrian. What I'm actually wondering about though is whether >>there is a "proper" way to clear out a session entirely? Is it just a >>matter of iterating through all of the keys and clearing them one by >>one? And on that note, I keep feeling like a user,

Re: Django DB Design Question (help please!)

2006-01-09 Thread patrick k
> Thanks Patrick, > > So, you are voting for the second model. I think Django should have > such relationship builtin where I can avoid defining user_id as a field > in my news table. actually, i don´t really see a difference between model 1 and 2. you have a company which you assign users to.

Re: Django DB Design Question (help please!)

2006-01-09 Thread Mike
Thanks Patrick, So, you are voting for the second model. I think Django should have such relationship builtin where I can avoid defining user_id as a field in my news table. I maybe wrong but I don't think (news.get_user.username) works in templates. I have to double check. Regards, Mike

Re: Django DB Design Question (help please!)

2006-01-09 Thread patrick k
within a view you could use news_list = news.get_list(user__id__exact=request.user.id) for the logged-in user to get the user within the template use news.get_user.username ... http://www.djangoproject.com/documentation/db_api/#many-to-one-relations hope that helps, patrick > > Hi, > > I

Django DB Design Question (help please!)

2006-01-09 Thread Mike
Hi, I have a model with multiple companies (Basecamp Style), where each have multiple users and multiple company news. Which of the two way is more appropriate: 1: Company -one-to-many> User one-to-many> NewsPosting 2: Company -one-to-many> User

Re: getting csv output (easily)?

2006-01-09 Thread Eric Walstad
On Monday 09 January 2006 08:31, tonemcd wrote: > Hi all, > I'm trying to graft additional functionality onto an admin site I have > running and decided that CSV was a good start... > > I have a urlconf that does this; > (r'^CSV/$', 'djangomysql.apps.subjcentre.views.change_list'), > > and

Re: manipulators and action log

2006-01-09 Thread patrick kranzlmüller
we´re working on a basecamp-like project management system which we´ll include into the admin-interface. therefore, we´re having custom views (based on Add- and ChangeManipulator) and we´d like to log user-actions. maybe i should just import log_add_message (e.g.) from admin.main. then again,

Re: manipulators and action log

2006-01-09 Thread Joseph Kocherhans
On 1/8/06, patrickk <[EMAIL PROTECTED]> wrote: > > > when using AddManipulator or ChangeManipulator, is there a convenient > > way of logging actions in admin_log? > > hmm, something wrong with this question? > i´d really appreciate some help. Could you be a little more specific? Currently,

Re: about xgettext

2006-01-09 Thread hugo
>Uh - there is no standard pygettext tool - there might be something by >that name that can be additionally installed, but the standard python Ok, to be more specific: some python installations on Linux distributions don't have it (like some older Debian for example). But the rest still stands:

Re: about xgettext

2006-01-09 Thread hugo
>And I want >to know is there a pure python way to do that? I know python provides >a pygettext tools, why not use it but xgettext? Uh - there is no standard pygettext tool - there might be something by that name that can be additionally installed, but the standard python stuff doesn't include a

Up and down in admin list

2006-01-09 Thread Rudolph
Hi, I'm completely new to Django and started some experiments to see if it fits my needs. Do the object-lists in the admin interface have to possibility for up/down buttons, to move an object up and down in the list, by adjusting a sorting value in the database. Inserting and deleting should

about xgettext

2006-01-09 Thread limodou
I'm working in xp box, and I want to make my app i18n support, but as I run make-messages.py, it complain that it cann't find xgettext. So I download it from gnu site, but as I run again, it crashed. And I want to know is there a pure python way to do that? I know python provides a pygettext

Passing more than one arguments to a custom filter

2006-01-09 Thread Aggelos Orfanakos
Hello. Is there an elegant way of passing more than one arguments to a custom filter? What I do now is pass a tuple from the view to the template that contains these arguments, and in the template, pass this tuple to the custom filter (which in the filter is seen as the "arg" parameter). Thanks

Re: Confused about where to put css and images

2006-01-09 Thread wiz
В Вск, 08/01/2006 в 16:24 -0500, Jeffrey E. Forcier пишет: > Oh, I see what you mean. I'm pretty sure you can just do an 'from > myproject import settings' in your view module, then throw the > variables from that into your template context, e.g. "context > ['MEDIA_URL'] =