Re: Django and MS SQL

2006-01-11 Thread Jeroen Ruigrok van der Werven
On 1/10/06, Cheng Zhang <[EMAIL PROTECTED]> wrote: > As matter of fact, I am trying to make pymssql backend for Django > work since in my current project we have to inherit a MS-SQL > database. Changing the database is definitely not an option. If > Django can be used with MS-SQL, then I can convin

Re: Duplicate object

2006-01-11 Thread Eric Walstad
On Wednesday 11 January 2006 19:00, Mike wrote: > Hi, > > How do I duplicate objects? Save_as style. > > Something like... > a=choices.get_list()[0] > a.poll_id = 2 > a.save() > > Except not to update the previous record > > Thanks, > Mike The following approach ('shallow' copy) has worked well

Re: Templates for Python Programmers error

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Maniac <[EMAIL PROTECTED]> wrote: > Also I would add that subclassing is ever needed only when one wants to > do something extremely fancy with the standard context, fields addition > is solved entirely by processors. Otherwise we have two ways of doing > this thing that look very simi

Re: application level settings

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Colleen Owens <[EMAIL PROTECTED]> wrote: > My latest question - I want to have some settings that apply to an > application (not the objects within that application's model but to the > application as a whole). For example, I want to have options like the > maximum number of objects t

Re: Postgre's with Django Model

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Mike <[EMAIL PROTECTED]> wrote: > I was trying to save my python objects into my database using Python's > marshal or pickle. O'Reilly's Python Cookbook suggests saving these > objects into 'bytea' BLOBs. I was wondering if Django's model provides > support for bytea? No, we've avoide

Re: Duplicate object

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Dody Suria Wijaya <[EMAIL PROTECTED]> wrote: > I think you meant __dict__, instead of __dict__(). Secondly, that would > still copy the primary key, which turns into update query on save. > An easy way to duplicate in choice case would be to set id as False > value (0, None, or False),

Re: Django, mod_python error

2006-01-11 Thread Kenneth Gonsalves
On Thursday 12 Jan 2006 4:23 am, [EMAIL PROTECTED] wrote: > ImproperlyConfigured: Error importing middleware > django.middleware.sessions: "No module named resumes" have you created any models in ~/models/resumes.py? -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.

Re: Common Practice with Models and Views

2006-01-11 Thread Kenneth Gonsalves
On Thursday 12 Jan 2006 3:12 am, Adrian Holovaty wrote: > > With models, is it common practice to place all models in a > > single file or multiple files? (I have a huge model) > > It's most common to put all your models in a single file. i have found it more convenient to have separate apps for

Re: Duplicate object

2006-01-11 Thread Dody Suria Wijaya
I think you meant __dict__, instead of __dict__(). Secondly, that would still copy the primary key, which turns into update query on save. An easy way to duplicate in choice case would be to set id as False value (0, None, or False), and thus force the saving routine to generate a new one and

Re: Postgre's with Django Model

2006-01-11 Thread Mike
Sorry, the subject was supposed to by "Postgre's Bytea Datatype with Django Model" Mike

Postgre's with Django Model

2006-01-11 Thread Mike
Hi, I was trying to save my python objects into my database using Python's marshal or pickle. O'Reilly's Python Cookbook suggests saving these objects into 'bytea' BLOBs. I was wondering if Django's model provides support for bytea? Thanks, Mike

Re: Duplicate object

2006-01-11 Thread Jeremy Dunck
On 1/11/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > a = choices.get_list()[0] > a.poll_id = 2 > new_choice = choices.Choice(**a.__dict__()) > new_choice.save() Oh, uh, wouldn't you not want to assign poll_id at all on the new obj? Assigning =2 could overlay an existing id r

Re: Duplicate object

2006-01-11 Thread Mike
Thanks Adrian. Very Useful. Mike

Re: Duplicate object

2006-01-11 Thread Jeremy Dunck
On 1/11/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > For example the following two statements are > functionally identical: > > write_love_letter(to='python', from='adrian') > write_love_letter(**{'to': 'python', 'from': 'adrian'}) But we'd need unicode to do this: ;-) write_love_let

Re: Duplicate object

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Mike <[EMAIL PROTECTED]> wrote: > How do I duplicate objects? Save_as style. > > Something like... > a=choices.get_list()[0] > a.poll_id = 2 > a.save() > > Except not to update the previous record You could do this: a = choices.get_list()[0] a.poll_id = 2 new_choice = cho

Duplicate object

2006-01-11 Thread Mike
Hi, How do I duplicate objects? Save_as style. Something like... a=choices.get_list()[0] a.poll_id = 2 a.save() Except not to update the previous record Thanks, Mike

Django, mod_python error

2006-01-11 Thread [EMAIL PROTECTED]
Hello, I've recently started to learn Django. I'm having a problem setting it up with apache2 and mod_python on Ubuntu 5.10. These are my mod_python settings in apache """ SetHandler mod_python PythonPath "['/home/rousseau/code/django'] + sys.path" PythonHandler django.core.handl

Re: Django and MS SQL

2006-01-11 Thread Jeremy Dunck
On 1/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > think adodbapi DOES use parameterization. It's just slightly > non-standard. (thus, the %s -> ? stuff above) I was surprised by this, by the Python DB API allows for parameters in the string supplied to the provider, and makes it provider

Re: Common Practice with Models and Views

2006-01-11 Thread Mike
Thanks for your helpful response Mike

Re: Common Practice with Models and Views

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Mike <[EMAIL PROTECTED]> wrote: > With models, is it common practice to place all models in a single file > or multiple files? (I have a huge model) It's most common to put all your models in a single file. > With views, is it common practice to place all views in a single file? > It

Re: Common Practice with Models and Views

2006-01-11 Thread Joseph Kocherhans
On 1/11/06, Mike <[EMAIL PROTECTED]> wrote: > > Hi, > > With models, is it common practice to place all models in a single file > or multiple files? (I have a huge model) > > With views, is it common practice to place all views in a single file? > It seems like django encourages that by removing t

Re: multiple levels of join

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Cheng Zhang <[EMAIL PROTECTED]> wrote: > class Entry(meta.Model): > submission_user = meta.ForeignKey(users.User) > > class Friend(meta.Model): > myself = meta.ForeignKey(users.User, related_name="myself", > verbose_name="myself") > friend = meta.ForeignKey(user

Re: Django and MS SQL

2006-01-11 Thread [EMAIL PROTECTED]
Actually...SQL Server would cache the execution plan anyway. It's gotten smart enough to do that now. (When parsing the statement, it recognizes the "style", and caches the plan like it would for a parameterized query. They call it auto-parameterization, IIRC.). Parameters improve the db engine's

Common Practice with Models and Views

2006-01-11 Thread Mike
Hi, With models, is it common practice to place all models in a single file or multiple files? (I have a huge model) With views, is it common practice to place all views in a single file? It seems like django encourages that by removing the view folder, but I don't see why? Multiple view files a

multiple levels of join

2006-01-11 Thread Cheng Zhang
I'd like to ask a question on multiple levels of join. My models are: class Entry(meta.Model): submission_user = meta.ForeignKey(users.User) class Friend(meta.Model): myself = meta.ForeignKey(users.User, related_name="myself", verbose_name="myself") friend = meta.ForeignKey(users.U

Re: OS X 10.4.4 update breaks filter_interface in Safari

2006-01-11 Thread Wilson
Found it! line 88 of SelectFilter2.js: addEvent(from_box, 'focus', function() { filter_input.focus(); }); Fix on its way from Jacob. Carry on!

OS X 10.4.4 update breaks filter_interface in Safari

2006-01-11 Thread Wilson
The Safari/WebKit updates in 10.4.4 seem to be rendering the many-to-many filter interface unusable. The select element for "available choices" never receives focus. When you click on the available choices, Safari focuses on the filter input field instead. The end result is that you can't select

Re: permission without a model?

2006-01-11 Thread Jacob Kaplan-Moss
On Jan 11, 2006, at 12:37 PM, gabor wrote: i'd like to create a permission with is not related to any model object. is there a way to create such permission? INSERT INTO auth_permissions (name, package, codename) VALUES (); Jacob

permission without a model?

2006-01-11 Thread gabor
hi, i'd like to create a permission with is not related to any model object. is there a way to create such permission? for now i'm just adding them to a model object, but that's a little ugly :( gabor

Re: SQLite threading

2006-01-11 Thread Maniac
Eugene Lazutkin wrote: It looks pretty much like the patch #463, which fixed multi-threading problem for MySQL. AFAIR, somebody ported it to PostGres. That was me: http://code.djangoproject.com/ticket/900 However the patch there wasn't included (yet?). Now sqlite has similar problem. Maybe w

Re: scheduling capabilities?

2006-01-11 Thread Adrian Holovaty
On 1/11/06, Colleen Owens <[EMAIL PROTECTED]> wrote: > And another question quick on the heels of the last one...Does Django have > any built-in scheduling capabilities, like "run X every 15 minutes"? Or > should I stick with Twisted for that? For this sort of stuff, we generally just create smal

scheduling capabilities?

2006-01-11 Thread Colleen Owens
And another question quick on the heels of the last one...Does Django have any built-in scheduling capabilities, like "run X every 15 minutes"? Or should I stick with Twisted for that? Thanks again. Colleen

ANN: Django 0.91 released

2006-01-11 Thread Adrian Holovaty
We're pleased to announce Django 0.91, the result of a month and a half of feature additions, bug fixes and other improvements. http://www.djangoproject.com/download/ I know many of the Django faithful use the Django development version (SVN), which is updated almost every day (and recommended b

application level settings

2006-01-11 Thread Colleen Owens
Hi. First I want to thank everyone for answering my really basic questions. The responses I've gotten here have been extremely helpful. I'm starting to get the hang of Django a little bit and I love it so far. My latest question - I want to have some settings that apply to an application (not the

Re: Templates for Python Programmers error

2006-01-11 Thread Maniac
Jacob Kaplan-Moss wrote: Thanks for the heads up; I've fixed the error in [1909]. On a similar note... Right after template context processors there is a mention of the ability to subclass the standard context and there are two warnings about remembering to use it and not overriding default

Re: Django admin Chinese character problem.

2006-01-11 Thread Albert Lee
I have located the problem on the database: mysql.  and when I change to sqlite, it works prettyso , I think there should be something character setting matter with the mysql database( I have made the "set character set =utf8" in mysql shell.) 2006/1/11, Gábor Farkas <[EMAIL PROTECTED]>: Jeroen Rui

Django Jobs

2006-01-11 Thread Alice
I found this (http://www.jobserve.com/W2EAE51AB3A3157A6.job) a few days ago while job hunting, it's probably taken already (it was posted a week ago) - but it's interesting to see jobs appearing in Australia - if only Adelaide! alas, Alice

Re: Templates for Python Programmers error

2006-01-11 Thread Jacob Kaplan-Moss
Hey Alice -- Thanks for the heads up; I've fixed the error in [1909]. Jacob

Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas
Jeroen Ruigrok van der Werven wrote: For my Japanese<>Dutch dictionary project I didn't have to do anything fancy. Only thing I had added to my base template is: Nothing else is/was needed. i understand you. but the code mr. Gonsales quoted did not do anything with the webpage (at least i

Re: Django admin Chinese character problem.

2006-01-11 Thread Jeroen Ruigrok van der Werven
For my Japanese<>Dutch dictionary project I didn't have to do anything fancy. Only thing I had added to my base template is: Nothing else is/was needed. -- Jeroen Ruigrok van der Werven

Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas
Kenneth Gonsalves wrote: On Wednesday 11 Jan 2006 7:18 pm, Gábor Farkas wrote: Kenneth Gonsalves wrote: On Wednesday 11 Jan 2006 5:46 pm, Gábor Farkas wrote: event = events.get_list()[0] title = event.title.decode('utf8') why do you need this? dont you set the utf8 in the tem

Re: Django admin Chinese character problem.

2006-01-11 Thread Kenneth Gonsalves
On Wednesday 11 Jan 2006 7:18 pm, Gábor Farkas wrote: > Kenneth Gonsalves wrote: > > On Wednesday 11 Jan 2006 5:46 pm, Gábor Farkas wrote: > >>event = events.get_list()[0] > >>title = event.title.decode('utf8') > > > > why do you need this? dont you set the utf8 in the > > template

Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas
Kenneth Gonsalves wrote: On Wednesday 11 Jan 2006 5:46 pm, Gábor Farkas wrote: event = events.get_list()[0] title = event.title.decode('utf8') why do you need this? dont you set the utf8 in the template/webpage itself? ? :) if i want to work with the title, i HAVE TO de

Templates for Python Programmers error

2006-01-11 Thread Alice
In the templates documentation for python programmers (http://www.djangoproject.com/documentation/templates_python/#subclassing-context-djangocontext) it's pointed out that a DjangoContext is different in that it 'takes an HttpRequest object as its first argument.' Then in this example where you

Re: Django admin Chinese character problem.

2006-01-11 Thread Kenneth Gonsalves
On Wednesday 11 Jan 2006 5:46 pm, Gábor Farkas wrote: > event = events.get_list()[0] > title = event.title.decode('utf8') why do you need this? dont you set the utf8 in the template/webpage itself? -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.or

Re: best practices for translating content

2006-01-11 Thread hugo
>Wouldn't it be a cleaner approach to seperate language dependent >content completely from the actual models. It's more "DRY" because you >only define the text fields on one place. Depends. My idea is to have a situation similar with gettext: you provide default content that can be translated. If

Re: best practices for translating content

2006-01-11 Thread Rudolph
Wouldn't it be a cleaner approach to seperate language dependent content completely from the actual models. It's more "DRY" because you only define the text fields on one place. You could even introduce a site-wide model for all language dependent content like this: class Content(meta.Model):

Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas
Albert Lee wrote: I use uft-8 encoding, and in admin page, when I insert a record, the Chinese character will become ? hi, i am not sure what exactly are you trying to do, here is what i did as a quick test. my config: postgresql-8.0. database created as UNICODE (which in case of postgr

Re: best practices for translating content

2006-01-11 Thread hugo
>so 'thing' and 'language' will be unique_together. and to actually >do the translation, a form which will give side by side areas, one >displaying the values in 'Thing' and the other giving space to fill >in the values for 'TranslatedThing'. >TranslatedThing would only have those fields in Thing