Re: Draft branch: Swappable User models in contrib.auth

2012-08-23 Thread Russell Keith-Magee
On Thu, Aug 23, 2012 at 10:16 PM, sergzach wrote: > The question about databases. > > Do I understand correctly that if we create a MyUser class (as in your > example) then extra fields (e.g. date_of_birth) will be stored in the same > table of a database with inherited fields (from AbstractBaseUs

Re: Draft branch: Swappable User models in contrib.auth

2012-08-23 Thread sergzach
The question about databases. Do I understand correctly that if we create a MyUser class (as in your example) then extra fields (e.g. date_of_birth) will be stored in the same table of a database with inherited fields (from AbstractBaseUser)? > === > from django.db import models > > from dja

Re: Draft branch: Swappable User models in contrib.auth

2012-08-22 Thread Daniel Sokolowski
Just felt compelled to say: "Thank you for the hard work". -Original Message- From: Russell Keith-Magee Sent: Monday, August 20, 2012 9:40 PM To: django-developers@googlegroups.com Subject: Re: Draft branch: Swappable User models in contrib.auth On Mon, Aug 20, 2012

Re: Draft branch: Swappable User models in contrib.auth

2012-08-20 Thread Russell Keith-Magee
On Mon, Aug 20, 2012 at 7:11 AM, Russell Keith-Magee wrote: > On Sun, Aug 19, 2012 at 10:02 AM, Victor Hooi wrote: >> Hi, >> >> I'm just wondering, has there been any updates on the User model refactor? >> >> My understanding is that this is the official way of handling Users going >> forward. >>

Re: Draft branch: Swappable User models in contrib.auth

2012-08-19 Thread Marc Tamlyn
Ah, thanks Russ, I'd missed the final resolution to that. M On Monday, 20 August 2012 00:12:18 UTC+1, Russell Keith-Magee wrote: > > On Sun, Aug 19, 2012 at 5:23 PM, Marc Tamlyn > > > wrote: > > I believe changes to auth (and several other things) are waiting for > > contrib.migrations. It wi

Re: Draft branch: Swappable User models in contrib.auth

2012-08-19 Thread Russell Keith-Magee
On Sun, Aug 19, 2012 at 5:23 PM, Marc Tamlyn wrote: > I believe changes to auth (and several other things) are waiting for > contrib.migrations. It will be some time... Incorrect. The strategy that was approved for trunk won't require migrations unless you want to change an existing project, whic

Re: Draft branch: Swappable User models in contrib.auth

2012-08-19 Thread Russell Keith-Magee
On Sun, Aug 19, 2012 at 10:02 AM, Victor Hooi wrote: > Hi, > > I'm just wondering, has there been any updates on the User model refactor? > > My understanding is that this is the official way of handling Users going > forward. > > Is there any roadmap on when it might hit trunk? I didn't see any r

Re: Draft branch: Swappable User models in contrib.auth

2012-08-19 Thread Marc Tamlyn
I believe changes to auth (and several other things) are waiting for contrib.migrations. It will be some time... On Sunday, 19 August 2012 03:02:51 UTC+1, Victor Hooi wrote: > > Hi, > > I'm just wondering, has there been any updates on the User model refactor? > > My understanding is that this is

Re: Draft branch: Swappable User models in contrib.auth

2012-08-18 Thread Victor Hooi
Hi, I'm just wondering, has there been any updates on the User model refactor? My understanding is that this is the official way of handling Users going forward. Is there any roadmap on when it might hit trunk? I didn't see any reference to User models in the 1.5 release notes. Cheers, Victor

Re: Draft branch: Swappable User models in contrib.auth

2012-06-10 Thread Anssi Kääriäinen
On 10 kesä, 10:42, Russell Keith-Magee wrote: > I'm not sure I see why. This looks to me like *exactly* what apps are > designed to achieve. By way of implementation, it might make sense to > introduce this as a 'sub app' - i.e., contrib.auth.improveduser would > be an installable app in itself; t

Re: Draft branch: Swappable User models in contrib.auth

2012-06-10 Thread Russell Keith-Magee
On Fri, Jun 8, 2012 at 7:50 PM, Anssi Kääriäinen wrote: > On 8 kesä, 13:43, Russell Keith-Magee wrote: >> That's certainly an interesting use case. However, I can think of at >> least 2 ways it could be mitigated. >> >> One way would be to treat this as part of the contract of a pluggble >> app.

Re: Draft branch: Swappable User models in contrib.auth

2012-06-08 Thread Anssi Kääriäinen
On 8 kesä, 13:43, Russell Keith-Magee wrote: > That's certainly an interesting use case. However, I can think of at > least 2 ways it could be mitigated. > > One way would be to treat this as part of the contract of a pluggble > app. We've always said that an app should do one thing, and one thing

Re: Draft branch: Swappable User models in contrib.auth

2012-06-08 Thread Russell Keith-Magee
On Fri, Jun 8, 2012 at 8:53 AM, Anssi Kääriäinen wrote: > On 8 kesä, 02:43, Russell Keith-Magee wrote: >> >  - For documentation: It should be suggested that the example MyUser >> > should define class Meta: swappable = 'AUTH_USER_MODEL'. Otherwise it >> > will be synced to the database even if i

Re: Draft branch: Swappable User models in contrib.auth

2012-06-07 Thread Anssi Kääriäinen
On 8 kesä, 02:43, Russell Keith-Magee wrote: > Good idea. I haven't tried to see what it actually does; I'm guessing > you're going to get Table Does Not Exist errors. A nicer error > wouldn't hurt. Yes, that is what happens. > >  - For documentation: It should be suggested that the example MyUs

Re: Draft branch: Swappable User models in contrib.auth

2012-06-07 Thread Russell Keith-Magee
On Thu, Jun 7, 2012 at 7:48 PM, Anssi Kääriäinen wrote: > On Jun 7, 11:57 am, Florian Apolloner wrote: >> Hi, >> >> On Wednesday, June 6, 2012 4:32:02 PM UTC+2, Anssi Kääriäinen wrote: >> >> > Still, yet another API idea: [snip] >> >> Then, Model.__new__ will replace the SwappableUser class with

Re: Draft branch: Swappable User models in contrib.auth

2012-06-07 Thread Anssi Kääriäinen
On Jun 7, 11:57 am, Florian Apolloner wrote: > Hi, > > On Wednesday, June 6, 2012 4:32:02 PM UTC+2, Anssi Kääriäinen wrote: > > > Still, yet another API idea: [snip] > > Then, Model.__new__ will replace the SwappableUser class with the > > > swapped in class. The 'swappable' in model.Meta tells wh

Re: Draft branch: Swappable User models in contrib.auth

2012-06-07 Thread Florian Apolloner
Hi, On Wednesday, June 6, 2012 4:32:02 PM UTC+2, Anssi Kääriäinen wrote: > > Still, yet another API idea: [snip] > > Then, Model.__new__ will replace the SwappableUser class with the > swapped in class. The 'swappable' in model.Meta tells which concrete > model implementation to use. > I'd r

Re: Draft branch: Swappable User models in contrib.auth

2012-06-06 Thread Anssi Kääriäinen
On Jun 6, 9:20 am, Russell Keith-Magee wrote: > wrote: > > Understood & agreed (the "this model is dynamic made explicit" part > > seems really important specifically). > > > I am afraid of the hard-coding of meta.swappable must be 'SOME_VAR' > > which then references settings.SOME_VAR, and that

Re: Draft branch: Swappable User models in contrib.auth

2012-06-06 Thread Andrew Ingram
On 4 June 2012 16:12, Russell Keith-Magee wrote: >  * The swapping mechanic is set up using a new Meta option on models > called 'swappable' that defines the setting where an alternate model > can be defined. Technically, the swappable option *could* be used for > any model; however, I'm not propo

Re: Draft branch: Swappable User models in contrib.auth

2012-06-05 Thread Russell Keith-Magee
On Tue, Jun 5, 2012 at 9:00 PM, Anssi Kääriäinen wrote: > Understood & agreed (the "this model is dynamic made explicit" part > seems really important specifically). > > I am afraid of the hard-coding of meta.swappable must be 'SOME_VAR' > which then references settings.SOME_VAR, and that this is

Re: Draft branch: Swappable User models in contrib.auth

2012-06-05 Thread Anssi Kääriäinen
On Jun 5, 2:44 pm, Russell Keith-Magee wrote: > Two significant reasons: > > Firstly, if we use the Meta attribute approach, we can raise a > specific validation error when the user has an app with a model that > references auth.User directly, and User has been swapped out. This is > mostly useful

Re: Draft branch: Swappable User models in contrib.auth

2012-06-05 Thread Russell Keith-Magee
On Tue, Jun 5, 2012 at 3:56 AM, Anssi Kääriäinen wrote: > On Jun 4, 6:12 pm, Russell Keith-Magee > wrote: >>  * The swapping mechanic is set up using a new Meta option on models >> called 'swappable' that defines the setting where an alternate model >> can be defined. Technically, the swappable o

Re: Draft branch: Swappable User models in contrib.auth

2012-06-04 Thread Anssi Kääriäinen
On Jun 4, 6:12 pm, Russell Keith-Magee wrote: >  * The swapping mechanic is set up using a new Meta option on models > called 'swappable' that defines the setting where an alternate model > can be defined. Technically, the swappable option *could* be used for > any model; however, I'm not proposin

Draft branch: Swappable User models in contrib.auth

2012-06-04 Thread Russell Keith-Magee
Hi all, Following the BDFL pronouncement of a preferred option for customisable User models in contrib.auth [1], I've just pushed a branch to Github that contains a draft implementation [2]. It's not ready for trunk quite yet, but you can use this code to set up a custom User model, and then log