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'] = settings.MEDIA_URL"

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 i

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 tools

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 also

Re: Up and down in admin list

2006-01-09 Thread Jacob Kaplan-Moss
On Jan 9, 2006, at 8:43 AM, Rudolph wrote: 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 data

Re: Passing more than one arguments to a custom filter

2006-01-09 Thread EricHsu
hi Aggelos, if you pass a tuple to your custom filter, then the arg should become the tuple you could access. I tried something like this (for testing purpose :): {{ story.summary|myfilter:story }} then inside the myfilter, I can: def myfilter(value, arg): story = arg title = story.title

Re: Passing more than one arguments to a custom filter

2006-01-09 Thread Aggelos Orfanakos
Hello Eric. Thanks for your reply. As I wrote in my initial post, I have already done this. I was wondering if there is a more elegant way. Aggelos.

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

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

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

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/9/06, patrick kranzlmüller <[EMAIL PROTECTED]> wrote: > > 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

getting csv output (easily)?

2006-01-09 Thread tonemcd
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 the change_list method in 'views' looks like this; def change_li

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 the

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

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 hav

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

Re: Session disposal

2006-01-09 Thread Adrian Holovaty
On 1/8/06, John Martin <[EMAIL PROTECTED]> wrote: > 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 feel

Re: Django DB Design Question (help please!)

2006-01-09 Thread Mike
Thanks Patrick, > actually, i don´t really see a difference between model 1 and 2. In model 1, there is no direct relationship between the company table and posting table, and for the company to find out what news it has, it has to go through the users table. Also, for a posting to find out to w

Re: Django DB Design Question (help please!)

2006-01-09 Thread Adrian Holovaty
On 1/9/06, Mike <[EMAIL PROTECTED]> wrote: > 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 --

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

Re: ANN: "Snakes and Rubies" (Django/Rails meetup) video/audio available

2006-01-09 Thread Eugene Lazutkin
Jacob Kaplan-Moss wrote: Sure, go for it. Let me know when it's done and I'll add links to Google to the page. Update: full video and Django part are successfully uploaded and "currently being verified" (whatever it means). Apparently it takes a lot of time. RoR part and Q&A part are in th

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

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: about xgettext

2006-01-09 Thread limodou
2006/1/9, hugo <[EMAIL PROTECTED]>: > > >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 De

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

Re: Django DB Design Question (help please!)

2006-01-09 Thread Mike
Dody, > ...for performance reason I would put both foreignkey > (one 2 many) to company and user in newsposting model... I was actually thinking about that, was wondering if it breaks the system for some unknown reason. I am glad it is common practice and I can count on it within my application.

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

Re: Django DB Design Question (help please!)

2006-01-09 Thread Mike
Kenneth, > the whole idea of having an rdbms is that it maintains > integrity of data. And data without unique primary keys is not > data, it is junk Well, if my app can't manage to respect the data integrity, then my app is junk! I have no objection against data integrity either, redundant but

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? I'

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

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: about xgettext

2006-01-09 Thread limodou
2006/1/10, hugo <[EMAIL PROTECTED]>: > > >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. > :)

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 the

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 schem

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'] = 'atta

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

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