Re: multiple levels of join

2006-01-12 Thread Cheng Zhang
On Jan 12, 2006, at 5:38 AM, Adrian Holovaty wrote: 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",

Workflow

2006-01-12 Thread Taifu
Hello, a simple question for the experts: if I need a publishing workflow (usual stuff: author, editor, approver, etc. etc.) within a Django app, I've to build everything from scratch or I've some library helper? Thanks for your time. Ciao. Marco. Time: the only thing that taken up can't be

Re: application level settings

2006-01-12 Thread Colleen Owens
On 1/11/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: 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

Re: Duplicate object

2006-01-12 Thread Robert Wittams
Adrian Holovaty wrote: > On 1/12/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > >>On Jan 12, 2006, at 8:09 AM, Simon Willison wrote: >> >>>Maybe it would be useful for all Django model objects to gain >>>themselves a duplicate() method which does exactly this - returns >>>an identical object

Re: How are default values for fields used

2006-01-12 Thread Maniac
akaihola wrote: Ok, I'll take a look at the _pre_save() mechanism. By the way, isn't that one of the things changing in magic-removal branch? Yes, it goes away. Instead one would be able to override save() and do everything in it. I still wonder about the default values question though.

Re: Postgre's with Django Model

2006-01-12 Thread Mike
I see. I'll try to work around it somehow. Thanks, Mike

Re: Duplicate object

2006-01-12 Thread Adrian Holovaty
On 1/12/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > On Jan 12, 2006, at 8:09 AM, Simon Willison wrote: > > Maybe it would be useful for all Django model objects to gain > > themselves a duplicate() method which does exactly this - returns > > an identical object but with id set to None. >

Re: How are default values for fields used

2006-01-12 Thread akaihola
It seems that _pre_save() is never called if the manipulator catches missing fields. So customizing the manipulator seems to be my quick fix after all. I also checked the manipulator objects' attributes, and default values defined in models don't even end up there. So it might require quite a

Re: Django and MS SQL

2006-01-12 Thread Ken Kennedy
Jeremy Dunck wrote: > 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

Re: How are default values for fields used

2006-01-12 Thread akaihola
Ok, I'll take a look at the _pre_save() mechanism. By the way, isn't that one of the things changing in magic-removal branch? I still wonder about the default values question though. I tried to create a Django object in an interactive Python shell, and the fields are indeed filled with default

Re: global class Category

2006-01-12 Thread Daniel Ericsson
On 12 jan 2006, at 15.40, Grigory Fateyev wrote: Hello! In my project need lots of time to create class Category for any apps (news, faq, clubs) and now whant to create global class Category that will many-to-one for other classes. How this class can be done? Put your Category model in a

Re: Django and MS SQL

2006-01-12 Thread Joseph Kocherhans
On 1/12/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 1/12/06, Rich Bakos <[EMAIL PROTECTED]> wrote: > > The pymssql driver only supports DB-LIB, which is way outdated and you > > wont have access to functionality added to MSSQL after version 6.5. > > This is not the best option IMHO. > >

Re: Django and MS SQL

2006-01-12 Thread Jeremy Dunck
On 1/12/06, Rich Bakos <[EMAIL PROTECTED]> wrote: > The pymssql driver only supports DB-LIB, which is way outdated and you > wont have access to functionality added to MSSQL after version 6.5. > This is not the best option IMHO. Adapter class over adodbapi where supported, falling back to

Re: Duplicate object

2006-01-12 Thread Jacob Kaplan-Moss
On Jan 12, 2006, at 8:09 AM, Simon Willison wrote: Maybe it would be useful for all Django model objects to gain themselves a duplicate() method which does exactly this - returns an identical object but with id set to None. +1 -- obj.copy() might be a better syntax to mimic dict.copy().

Re: Duplicate object

2006-01-12 Thread Dody Suria Wijaya
Simon Willison wrote: Maybe it would be useful for all Django model objects to gain themselves a duplicate() method which does exactly this - returns an identical object but with id set to None. There is still complication for non autofield primary key. And it's just 3 lines or under. --

global class Category

2006-01-12 Thread Grigory Fateyev
Hello! In my project need lots of time to create class Category for any apps (news, faq, clubs) and now whant to create global class Category that will many-to-one for other classes. How this class can be done? Or this is not good idea? -- Всего наилучшего! greg [at] anastasia [dot] ru

Re: Duplicate object

2006-01-12 Thread Simon Willison
On 12 Jan 2006, at 05:43, Eric Walstad wrote: The following approach ('shallow' copy) has worked well for me: import copy b = copy.copy(a) b.id = None b.save() Maybe it would be useful for all Django model objects to gain themselves a duplicate() method which does exactly this - returns

Re: Django, mod_python error

2006-01-12 Thread [EMAIL PROTECTED]
>> have you created any models in ~/models/resumes.py? Yep, I have a Resume model in /modes/resumes.py

Re: multiple levels of join

2006-01-12 Thread Russell Keith-Magee
On 1/12/06, Adrian Holovaty <[EMAIL PROTECTED] > wrote: > > You can do it in two queries: > > my_friends = friends.get_list(myself__exact=my_id) > entries.get_list(submission_user__in=[f.id for f in my_friends]) If you are using the magic-removal branch, there is an alternative approach that

Re: How are default values for fields used

2006-01-12 Thread Maniac
akaihola wrote: So, if I'm not mistaken, the default values for a model's fields are not used when saving an object, They are used to prefill form elements in the Admin (don't know about custom forms though, never tried). So it's just a hint for the user. and I must create a custom

How are default values for fields used

2006-01-12 Thread akaihola
In the admin interface, I can't omit fields from "admin = meta.Admin(fields=...)" even if they do have default values. If I do that, I get errors for required fields. In my own forms, I first assumed I could just leave out fields with default values in the model, but my form.error_dict gets